MCPcopy Create free account
hub / github.com/alibaba/PhotonLibOS / stub

Method stub

thread/thread-pool.cpp:92–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 4

thread_yield_toFunction · 0.85
deallocate_tlsFunction · 0.85
startMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected