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

Function waker

test/bthread_futex_unittest.cpp:152–165  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150butil::atomic<int> nevent(0);
151
152void* waker(void* lock) {
153 bthread_usleep(10000);
154 const size_t REP = 100000;
155 int nwakeup = 0;
156 butil::Timer tm;
157 tm.start();
158 for (size_t i = 0; i < REP; ++i) {
159 nwakeup += bthread::futex_wake_private(lock, 1);
160 }
161 tm.stop();
162 EXPECT_EQ(0, nwakeup);
163 printf("futex_wake nop = %" PRId64 "ns\n", tm.n_elapsed() / REP);
164 return NULL;
165}
166
167void* batch_waker(void* lock) {
168 bthread_usleep(10000);

Callers

nothing calls this directly

Calls 5

bthread_usleepFunction · 0.85
n_elapsedMethod · 0.80
futex_wake_privateFunction · 0.50
startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected