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

Function odd_thread

test/bthread_setconcurrency_unittest.cpp:67–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65static butil::atomic<bool> stop (false);
66
67static void *odd_thread(void *) {
68 nbthreads.fetch_add(1);
69 while (!stop) {
70 if (!counted) {
71 counted = true;
72 npthreads.fetch_add(1);
73 }
74 bthread::butex_wake_all(even);
75 bthread::butex_wait(odd, 0, NULL);
76 }
77 return NULL;
78}
79
80static void *even_thread(void *) {
81 nbthreads.fetch_add(1);

Callers

nothing calls this directly

Calls 3

butex_wake_allFunction · 0.85
butex_waitFunction · 0.85
fetch_addMethod · 0.80

Tested by

no test coverage detected