| 476 | } |
| 477 | |
| 478 | WorkQueue::~WorkQueue() { |
| 479 | { |
| 480 | butil::AutoLock auto_lock(lock_); |
| 481 | SetShutdown(); |
| 482 | } |
| 483 | work_is_available_.Broadcast(); // Tell them all to terminate. |
| 484 | |
| 485 | for (int i = 0; i < thread_count_; ++i) { |
| 486 | PlatformThread::Join(thread_handles_[i]); |
| 487 | } |
| 488 | EXPECT_EQ(0, waiting_thread_count_); |
| 489 | } |
| 490 | |
| 491 | int WorkQueue::GetThreadId() { |
| 492 | DFAKE_SCOPED_RECURSIVE_LOCK(locked_methods_); |