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

Function TEST

test/bthread_cond_bug_unittest.cpp:123–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123TEST(BthreadCondBugTest, test_bug) {
124 bthread_t tids[PRODUCER_NUM];
125 for (int i = 0; i < PRODUCER_NUM; i++) {
126 bthread_start_background(&tids[i], NULL, produce_func, (void*)(int64_t)i);
127 }
128 bthread_t tid;
129 bthread_start_background(&tid, NULL, consume_func, NULL);
130
131 int64_t ret = (int64_t)print_func(nullptr);
132
133 bthread_stop(tid);
134 bthread_join(tid, nullptr);
135 for (int i = 0; i < PRODUCER_NUM; i++) {
136 bthread_stop(tids[i]);
137 bthread_join(tids[i], nullptr);
138 }
139
140 ASSERT_EQ(ret, 1);
141}

Callers

nothing calls this directly

Calls 4

bthread_start_backgroundFunction · 0.85
print_funcFunction · 0.85
bthread_stopFunction · 0.85
bthread_joinFunction · 0.85

Tested by

no test coverage detected