| 109 | } |
| 110 | |
| 111 | static wait_handler get_thread_wait_handler() |
| 112 | { |
| 113 | #if defined(EMULATE_PTHREAD_THREAD_LOCAL) |
| 114 | // we need to call this here, because the pthread initializer is lazy, |
| 115 | // this means the it could be null and we need to set it before trying to |
| 116 | // get or set it |
| 117 | wait_handler handler = (wait_handler) pthread_getspecific(get_thread_wait_handler_key()); |
| 118 | if(handler == nullptr) { |
| 119 | return generic_wait_handler; |
| 120 | } |
| 121 | return handler; |
| 122 | #else |
| 123 | return thread_wait_handler; |
| 124 | #endif |
| 125 | } |
| 126 | |
| 127 | // Wait for a task to complete |
| 128 | void wait_for_task(task_base* wait_task) |
no test coverage detected