| 90 | return ret; |
| 91 | } |
| 92 | void* ThreadPoolBase::stub(void* arg) |
| 93 | { |
| 94 | TPControl ctrl; |
| 95 | auto th = *(thread**)arg; |
| 96 | *(TPControl**)arg = &ctrl; // tell ctor where my `ctrl` is |
| 97 | thread_yield_to(th); |
| 98 | while(wait_for_work(ctrl)) |
| 99 | { |
| 100 | ctrl.start(ctrl.arg); |
| 101 | deallocate_tls(); |
| 102 | auto should_put = after_work_done(ctrl); |
| 103 | if (should_put) { |
| 104 | // if has no other joiner waiting |
| 105 | // collect it into pool |
| 106 | ctrl.pool->put(&ctrl); |
| 107 | } |
| 108 | } |
| 109 | return nullptr; |
| 110 | } |
| 111 | bool ThreadPoolBase::do_thread_join(TPControl* pCtrl) |
| 112 | { |
| 113 | SCOPED_LOCK(pCtrl->m_mtx); |
nothing calls this directly
no test coverage detected