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

Function wait_thread

test/bthread_cond_unittest.cpp:341–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339};
340
341void* wait_thread(void* arg) {
342 BroadcastArg* ba = (BroadcastArg*)arg;
343 std::unique_lock<bthread::Mutex> lck(ba->mutex);
344 while (ba->rounds > 0) {
345 const int saved_round = ba->rounds;
346 ++ba->cur_waiter;
347 while (saved_round == ba->rounds) {
348 if (ba->cur_waiter >= ba->nwaiter) {
349 ba->broadcast_cond.notify_one();
350 }
351 ba->wait_cond.wait(lck);
352 }
353 }
354 return NULL;
355}
356
357void* broadcast_thread(void* arg) {
358 BroadcastArg* ba = (BroadcastArg*)arg;

Callers

nothing calls this directly

Calls 2

notify_oneMethod · 0.80
waitMethod · 0.45

Tested by

no test coverage detected