-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Commit
The old code (before commit 6444695) works well with Mingw-w64 which does not support this_thread. Signed-off-by: Stefan Weil <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,11 @@ | |
#include "helpers.h" | ||
#include "tprintf.h" | ||
|
||
#include <thread> | ||
#if defined(__MINGW32__) | ||
# include <unistd.h> | ||
#else | ||
# include <thread> | ||
#endif | ||
|
||
// Number of documents to read ahead while training. Doesn't need to be very | ||
// large. | ||
|
@@ -449,7 +453,11 @@ const ImageData* DocumentData::GetPage(int index) { | |
if (needs_loading) LoadPageInBackground(index); | ||
// We can't directly load the page, or the background load will delete it | ||
// while the caller is using it, so give it a chance to work. | ||
#if defined(__MINGW32__) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
stweil
Author
Member
|
||
sleep(1); | ||
#else | ||
std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
#endif | ||
} | ||
return page; | ||
} | ||
|
4 comments
on commit 120a5db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And who maintains linux builds crosscompiling on windows?
Some people actually doing so (I don't have references right now).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I normally build Tesseract almost daily from git source for my Multimedia Tools MinGW distribution, adding the library to my FFmpeg builds, for the ability to 'read' burnt-in subtitles. For the time being, I've reverted to Tesseract 1.3.1 because I do not know enough about thread programming to understand quite what changed (beyond adding missing headers). My compiler and all compiled code uses Win32 threads, not POSIX threads. But I shall try today's code straight away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The latest code should build with any recent Mingw-w64, no matter whether it is a cross build or native.
The previous code (without this commit) fails with the latest Debian cross packages, but builds on Windows with the latest Mingw-w64 included in Cygwin. I am still investigating the differences between these two cases. Both are based on Win32 threads.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote is for cygwin and for toolsets with full c++ support.
But this is only unnecessary burden.
What version of gcc is in mingw?
If it's >= gcc 4.9 , you should just add -std=c++11 somewhere to cc flags.
Please, check it and revert this commit.