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

Function waiter

test/bthread_butex_unittest.cpp:123–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121};
122
123void* waiter(void* arg) {
124 WaiterArg * wa = (WaiterArg*)arg;
125 const long t1 = butil::gettimeofday_us();
126 const int rc = bthread::butex_wait(
127 wa->butex, wa->expected_value, wa->ptimeout);
128 const long t2 = butil::gettimeofday_us();
129 if (rc == 0) {
130 EXPECT_EQ(wa->expected_result, 0) << bthread_self();
131 } else {
132 EXPECT_EQ(wa->expected_result, errno) << bthread_self();
133 }
134 LOG(INFO) << "after wait, time=" << (t2-t1) << "us";
135 return NULL;
136}
137
138TEST(ButexTest, sanity) {
139 const size_t N = 5;

Callers

nothing calls this directly

Calls 3

butex_waitFunction · 0.85
bthread_selfFunction · 0.85
gettimeofday_usFunction · 0.70

Tested by

no test coverage detected