| 339 | }; |
| 340 | |
| 341 | void* 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 | |
| 357 | void* broadcast_thread(void* arg) { |
| 358 | BroadcastArg* ba = (BroadcastArg*)arg; |
nothing calls this directly
no test coverage detected