| 13 | bool s_initialized = false; |
| 14 | |
| 15 | void TasksWorker() |
| 16 | { |
| 17 | for( ;; ) |
| 18 | { |
| 19 | IBlueCallbackMan::CallbackFunc func; |
| 20 | void* context; |
| 21 | { |
| 22 | std::unique_lock lk( s_tasksMutex ); |
| 23 | s_tasksCV.wait( lk, [] { return !s_tasks.empty(); } ); |
| 24 | func = s_tasks[0].first; |
| 25 | context = s_tasks[0].second; |
| 26 | s_tasks.erase( s_tasks.begin() ); |
| 27 | } |
| 28 | |
| 29 | ( *func )( context ); |
| 30 | } |
| 31 | } |
| 32 | |
| 33 | void AddToComputeQueue( IBlueCallbackMan::CallbackFunc pCb, void* pContext ) |
| 34 | { |