24 #ifndef TESSERACT_VIEWER_SVUTIL_H_ 25 #define TESSERACT_VIEWER_SVUTIL_H_ 32 #include <semaphore.h> 38 #define MAX(a, b) ((a > b) ? a : b) 42 #define MIN(a, b) ((a < b) ? a : b) 49 static void StartThread(
void *(*func)(
void*),
void* arg);
53 static void StartProcess(
const char* executable,
const char* args);
69 #elif defined(__APPLE__) 90 pthread_mutex_t mutex_;
112 SVNetwork(
const char* hostname,
int port);
118 void Send(
const char* msg);
136 char* msg_buffer_in_;
139 std::string msg_buffer_out_;
146 #endif // TESSERACT_VIEWER_SVUTIL_H_ void Close()
Close the connection to the server.
static void StartProcess(const char *executable, const char *args)
Starts a new process.
void Unlock()
Unlocks on a mutex.
void Send(const char *msg)
Put a message in the messagebuffer to the server and try to send it.
static void StartThread(void *(*func)(void *), void *arg)
Create new thread.
void Lock()
Locks on a mutex.
void Wait()
Wait on a semaphore.
void Signal()
Signal a semaphore.
SVAutoLock(SVMutex *mutex)
The SVSync class provides functionality for Thread & Process Creation.
SVSemaphore()
Sets up a semaphore.
SVMutex()
Sets up a new mutex.
SVNetwork(const char *hostname, int port)
Set up a connection to hostname on port.
static void ExitThread()
Signals a thread to exit.
void Flush()
Flush the buffer.