]> git.cworth.org Git - apitrace/blobdiff - common/workqueue_posix.cpp
Implement and use os::thread.
[apitrace] / common / workqueue_posix.cpp
index f46bbd977bd20ee87e5e273539df8512a38ac41d..7df7e54e1d4e3bbc845c555b89cc82c60cbc0fe2 100644 (file)
@@ -1,4 +1,3 @@
-#include <pthread.h>
 #include <queue>
 #include <assert.h>
 
@@ -85,7 +84,6 @@ void WorkQueue::destroy(void)
     mutex.unlock();
 }
 
-extern "C"
 void *WorkQueue__entry_thunk(void *data)
 {
     WorkQueue *thread = static_cast<WorkQueue *>(data);
@@ -96,17 +94,15 @@ void *WorkQueue__entry_thunk(void *data)
 }
 
 WorkQueue::WorkQueue(void) :
-    busy(false), exit_workqueue(false)
+    busy(false),
+    exit_workqueue(false),
+    thread(WorkQueue__entry_thunk, this)
 {
-    int err;
-
-    err = pthread_create(&handle, NULL, WorkQueue__entry_thunk, this);
-    assert(!err);
 }
 
 WorkQueue::~WorkQueue(void)
 {
-    pthread_join(handle, NULL);
+    thread.join();
 }
 
 }