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

Function TEST

test/bthread_countdown_event_unittest.cpp:38–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38TEST(CountdonwEventTest, sanity) {
39 std::vector<bthread_t> tids;
40 for (int n = 1; n < 10; ++n) {
41 Arg a;
42 a.num_sig = n;
43 a.event.reset(n);
44 for (int i = 0; i < n; ++i) {
45 bthread_t tid;
46 ASSERT_EQ(0, bthread_start_urgent(&tid, NULL, signaler, &a));
47 tids.push_back(tid);
48 }
49 a.event.wait();
50 ASSERT_EQ(0, a.num_sig.load(butil::memory_order_relaxed));
51 }
52 for (size_t i = 0; i < tids.size(); ++i) {
53 bthread_join(tids[i], NULL);
54 }
55}
56
57TEST(CountdonwEventTest, timed_wait) {
58 bthread::CountdownEvent event;

Callers

nothing calls this directly

Calls 10

bthread_start_urgentFunction · 0.85
bthread_joinFunction · 0.85
milliseconds_from_nowFunction · 0.85
timed_waitMethod · 0.80
signalMethod · 0.80
resetMethod · 0.45
push_backMethod · 0.45
waitMethod · 0.45
loadMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected