| 132 | } |
| 133 | |
| 134 | static threadpool_data_wrapper get_threadpool_data_wrapper() |
| 135 | { |
| 136 | #if defined(EMULATE_PTHREAD_THREAD_LOCAL) |
| 137 | threadpool_data_wrapper* wrapper = static_cast<threadpool_data_wrapper*>(pthread_getspecific(get_local_threadpool_data_key())); |
| 138 | if(wrapper == nullptr) { |
| 139 | // if, for some reason, the wrapper is not set, this won't cause a crash |
| 140 | return threadpool_data_wrapper(nullptr, 0); |
| 141 | } |
| 142 | return *wrapper; |
| 143 | #else |
| 144 | return threadpool_data_wrapper(owning_threadpool, thread_id); |
| 145 | #endif |
| 146 | } |
| 147 | |
| 148 | // Try to steal a task from another thread's queue |
| 149 | static task_run_handle steal_task(threadpool_data* impl, std::size_t thread_id) |
no test coverage detected