Skip to content

Commit

Permalink
CHECK that ThreadPool is given a positive num_threads (#1800)
Browse files Browse the repository at this point in the history
Signed-off-by: Mac Mason <mac@kingseye.net>
  • Loading branch information
macmason committed Jan 20, 2021
1 parent 802e9f1 commit 018dded
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions cartographer/common/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ void ThreadPoolInterface::SetThreadPool(Task* task) {
}

ThreadPool::ThreadPool(int num_threads) {
CHECK_GT(num_threads, 0) << "ThreadPool requires a positive num_threads!";
absl::MutexLock locker(&mutex_);
for (int i = 0; i != num_threads; ++i) {
pool_.emplace_back([this]() { ThreadPool::DoWork(); });
Expand Down

0 comments on commit 018dded

Please sign in to comment.