X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fos_workqueue.hpp;h=047d3dbb4125967f72a83cad68015b30e180aea3;hb=5b9a463db890e86b95c7ac37484704759eabc641;hp=1c6798c1ac3f08ce2ee7ca11a5517e30f427230b;hpb=e86f5a2f9b1e57ee2535a285f6385878c78cf0ea;p=apitrace diff --git a/common/os_workqueue.hpp b/common/os_workqueue.hpp index 1c6798c..047d3db 100644 --- a/common/os_workqueue.hpp +++ b/common/os_workqueue.hpp @@ -12,38 +12,35 @@ class WorkQueue; class WorkQueueWork { protected: - friend class WorkQueue; + friend class WorkQueue; public: - virtual void run(void) = 0; - virtual ~WorkQueueWork(void) { } + virtual void run(void) = 0; + virtual ~WorkQueueWork(void) { } }; -extern "C" -void *WorkQueue__entry_thunk(void *data); - class WorkQueue { - pthread_t handle; - std::queue work_queue; + std::queue work_queue; + + bool busy; + bool exit_workqueue; + os::condition_variable wake_cond; + os::condition_variable complete_cond; - bool busy; - bool exit_workqueue; - os::condition_variable wake_cond; - os::condition_variable complete_cond; + os::mutex mutex; - os::mutex mutex; + os::thread thread; - void wake_up_thread(void); - void thread_entry(void); - int run_tasks(void); - friend void *WorkQueue__entry_thunk(void *data); + void wake_up_thread(void); + int run_tasks(void); public: - void queue_work(WorkQueueWork *work); - void flush(void); - void destroy(void); + void thread_entry(void); + void queue_work(WorkQueueWork *work); + void flush(void); + void destroy(void); - WorkQueue(void); - ~WorkQueue(); + WorkQueue(void); + ~WorkQueue(); }; }