MCPcopy Create free account
hub / github.com/acl-dev/acl / wait

Method wait

lib_fiber/cpp/src/wait_group.cpp:65–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65void wait_group::wait()
66{
67 for(;;) {
68 long long state = state_;
69 int c = (int) (state >> 32);
70
71 // Return if no tasks.
72 if (c == 0) {
73 return;
74 }
75
76 // Increase the number of waiters, or get state again if failed.
77 if (state_.cas(state, state + 1) == state) {
78 bool found;
79#ifdef _DEBUG
80 unsigned long* tid = box_->pop(-1, &found);
81 assert(found);
82 delete tid;
83#else
84 (void) box_->pop(-1, &found);
85 assert(found);
86#endif
87 if(state_ == 0) {
88 return;
89 }
90
91 logger_fatal("Reused before previous wait has returned");
92 }
93 }
94}
95
96} // namespace acl

Callers

nothing calls this directly

Calls 2

casMethod · 0.80
popMethod · 0.45

Tested by

no test coverage detected