24 #ifndef TESSERACT_VIEWER_SVUTIL_H__
25 #define TESSERACT_VIEWER_SVUTIL_H__
30 #define snprintf _snprintf
31 #if (_MSC_VER <= 1400)
32 #define vsnprintf _vsnprintf
34 #pragma warning(disable:4786)
41 #include <semaphore.h>
47 #define MAX(a, b) ((a > b) ? a : b)
51 #define MIN(a, b) ((a < b) ? a : b)
58 static void StartThread(
void *(*func)(
void*),
void* arg);
62 static void StartProcess(
const char* executable,
const char* args);
78 #elif defined(__APPLE__)
99 pthread_mutex_t mutex_;
110 SVNetwork(
const char* hostname,
int port);
116 void Send(
const char* msg);
134 char* msg_buffer_in_;
137 std::string msg_buffer_out_;
144 #endif // TESSERACT_VIEWER_SVUTIL_H__
void Lock()
Locks on a mutex.
void Close()
Close the connection to the server.
void Flush()
Flush the buffer.
static void StartProcess(const char *executable, const char *args)
Starts a new process.
SVMutex()
Sets up a new mutex.
SVSemaphore()
Sets up a semaphore.
void Send(const char *msg)
Put a message in the messagebuffer to the server and try to send it.
static void ExitThread()
Signals a thread to exit.
void Wait()
Wait on a semaphore.
void Signal()
Signal a semaphore.
static void StartThread(void *(*func)(void *), void *arg)
Create new thread.
void Unlock()
Unlocks on a mutex.
The SVSync class provides functionality for Thread & Process Creation.
SVNetwork(const char *hostname, int port)
Set up a connection to hostname on port.