+ /** Constructor.
+ */
+ Mutex()
+ {
+ pthread_mutex_init(&putex, NULL);
+ }
+ /** Enter/enable the mutex lock.
+ */
+ void Lock()
+ {
+ pthread_mutex_lock(&putex);
+ }
+ /** Leave/disable the mutex lock.
+ */
+ void Unlock()
+ {
+ pthread_mutex_unlock(&putex);
+ }
+ /** Destructor
+ */
+ ~Mutex()
+ {
+ pthread_mutex_destroy(&putex);
+ }
+};
+
+class ThreadQueueData
+{
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ public:
+ ThreadQueueData()
+ {
+ pthread_mutex_init(&mutex, NULL);
+ pthread_cond_init(&cond, NULL);
+ }
+
+ ~ThreadQueueData()
+ {
+ pthread_mutex_destroy(&mutex);
+ pthread_cond_destroy(&cond);
+ }
+
+ void Lock()
+ {
+ pthread_mutex_lock(&mutex);
+ }
+
+ void Unlock()
+ {
+ pthread_mutex_unlock(&mutex);
+ }
+
+ void Wakeup()
+ {
+ pthread_cond_signal(&cond);
+ }
+
+ void Wait()
+ {
+ pthread_cond_wait(&cond, &mutex);
+ }