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

Method reset

src/bthread/countdown_event.cpp:80–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80void CountdownEvent::reset(int v) {
81 if (v < 0) {
82 LOG(ERROR) << "Invalid count=" << v;
83 return;
84 }
85 const int prev_counter =
86 ((butil::atomic<int>*)_butex)
87 ->exchange(v, butil::memory_order_release);
88 LOG_IF(ERROR, _wait_was_invoked && prev_counter)
89 << "Invoking reset() while count=" << prev_counter;
90 _wait_was_invoked = false;
91}
92
93int CountdownEvent::timed_wait(const timespec& duetime) {
94 _wait_was_invoked = true;

Callers 2

addressMethod · 0.45
run_main_taskMethod · 0.45

Calls 1

exchangeMethod · 0.45

Tested by

no test coverage detected