MCPcopy Create free account
hub / github.com/apache/brpc / timed_wait

Method timed_wait

src/bthread/countdown_event.cpp:93–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93int CountdownEvent::timed_wait(const timespec& duetime) {
94 _wait_was_invoked = true;
95 for (;;) {
96 const int seen_counter =
97 ((butil::atomic<int>*)_butex)->load(butil::memory_order_acquire);
98 if (seen_counter <= 0) {
99 return 0;
100 }
101 if (butex_wait(_butex, seen_counter, &duetime) < 0 &&
102 errno != EWOULDBLOCK && errno != EINTR) {
103 return errno;
104 }
105 }
106}
107
108} // namespace bthread

Callers 1

TESTFunction · 0.80

Calls 2

butex_waitFunction · 0.85
loadMethod · 0.45

Tested by 1

TESTFunction · 0.64