mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-11-24 02:59:07 +08:00
Provide SVSync::StartThread() with GRAPHICS_DISABLED
This commit is contained in:
parent
4c39775c2d
commit
57b7236f7f
@ -83,6 +83,27 @@ void SVMutex::Unlock() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// Create new thread.
|
||||
void SVSync::StartThread(void *(*func)(void*), void* arg) {
|
||||
#ifdef _WIN32
|
||||
LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
|
||||
DWORD threadid;
|
||||
HANDLE newthread = CreateThread(
|
||||
NULL, // default security attributes
|
||||
0, // use default stack size
|
||||
f, // thread function
|
||||
arg, // argument to thread function
|
||||
0, // use default creation flags
|
||||
&threadid); // returns the thread identifier
|
||||
#else
|
||||
pthread_t helper;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(&helper, &attr, func, arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef GRAPHICS_DISABLED
|
||||
|
||||
const int kMaxMsgSize = 4096;
|
||||
@ -186,29 +207,6 @@ void SVSemaphore::Wait() {
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// Create new thread.
|
||||
|
||||
void SVSync::StartThread(void *(*func)(void*), void* arg) {
|
||||
#ifdef _WIN32
|
||||
LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
|
||||
DWORD threadid;
|
||||
HANDLE newthread = CreateThread(
|
||||
NULL, // default security attributes
|
||||
0, // use default stack size
|
||||
f, // thread function
|
||||
arg, // argument to thread function
|
||||
0, // use default creation flags
|
||||
&threadid); // returns the thread identifier
|
||||
#else
|
||||
pthread_t helper;
|
||||
pthread_attr_t attr;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create(&helper, &attr, func, arg);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Place a message in the message buffer (and flush it).
|
||||
void SVNetwork::Send(const char* msg) {
|
||||
mutex_send_->Lock();
|
||||
|
Loading…
Reference in New Issue
Block a user