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

Function wait_all

thread/thread.cpp:2039–2051  ·  view source on GitHub ↗

* Waiting for all current vcpu photon threads finish * @return 0 for all done, -1 for failure */

Source from the content-addressed store, hash-verified

2037 * @return 0 for all done, -1 for failure
2038 */
2039 static int wait_all(RunQ rq, vcpu_t* vcpu) {
2040 auto &sleepq = vcpu->sleepq;
2041 auto &standbyq = vcpu->standbyq;
2042 while (!AtomicRunQ(rq).size_1or2() || !sleepq.empty() || !standbyq.empty()) {
2043 if (!sleepq.empty()) {
2044 // sleep till all sleeping threads ends
2045 thread_usleep(1000UL);
2046 } else {
2047 thread_yield();
2048 }
2049 }
2050 return 0;
2051 }
2052
2053 int wait_all() {
2054 RunQ rq;

Callers 4

TESTFunction · 0.85
TESTFunction · 0.85
vcpu_finiFunction · 0.85
TESTFunction · 0.85

Calls 6

AtomicRunQClass · 0.85
thread_yieldFunction · 0.85
size_1or2Method · 0.80
get_vcpuMethod · 0.80
thread_usleepFunction · 0.70
emptyMethod · 0.45

Tested by 3

TESTFunction · 0.68
TESTFunction · 0.68
TESTFunction · 0.68