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

Function WaitForTrue

test/brpc_streaming_rpc_unittest.cpp:227–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

225}
226
227static bool WaitForTrue(const std::atomic<bool>& f, int timeout_ms) {
228 const int64_t deadline_us = butil::gettimeofday_us() + (int64_t)timeout_ms * 1000L;
229 while (!f.load(std::memory_order_acquire) && butil::gettimeofday_us() < deadline_us) {
230 usleep(1000);
231 }
232 return f.load(std::memory_order_acquire);
233}
234
235TEST_F(StreamingRpcTest, sanity) {
236 brpc::Server server;

Callers 1

TEST_FFunction · 0.85

Calls 2

gettimeofday_usFunction · 0.70
loadMethod · 0.45

Tested by

no test coverage detected