-#include <pthread.h>
#include <queue>
#include <assert.h>
mutex.unlock();
}
-extern "C"
void *WorkQueue__entry_thunk(void *data)
{
WorkQueue *thread = static_cast<WorkQueue *>(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();
}
}