diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-20T21·27+0100 |
commit | 689ef502f5b0655c9923ed77da2ae3504630f473 (patch) | |
tree | 3e331c153646f136875f047cc3b9f0aad8c86341 /third_party/nix/src/libutil/thread-pool.cc | |
parent | d331d3a0b5c497a46e2636f308234be66566c04c (diff) |
refactor(3p/nix): Apply clang-tidy's readability-* fixes r/788
This applies the readability fixes listed here: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Diffstat (limited to 'third_party/nix/src/libutil/thread-pool.cc')
-rw-r--r-- | third_party/nix/src/libutil/thread-pool.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/third_party/nix/src/libutil/thread-pool.cc b/third_party/nix/src/libutil/thread-pool.cc index d0042c6df195..879de446c294 100644 --- a/third_party/nix/src/libutil/thread-pool.cc +++ b/third_party/nix/src/libutil/thread-pool.cc @@ -8,9 +8,9 @@ namespace nix { ThreadPool::ThreadPool(size_t _maxThreads) : maxThreads(_maxThreads) { restoreAffinity(); // FIXME - if (!maxThreads) { + if (maxThreads == 0u) { maxThreads = std::thread::hardware_concurrency(); - if (!maxThreads) { + if (maxThreads == 0u) { maxThreads = 1; } } @@ -111,8 +111,8 @@ void ThreadPool::doWork(bool mainThread) { try { std::rethrow_exception(exc); } catch (std::exception& e) { - if (!dynamic_cast<Interrupted*>(&e) && - !dynamic_cast<ThreadPoolShutDown*>(&e)) { + if ((dynamic_cast<Interrupted*>(&e) == nullptr) && + (dynamic_cast<ThreadPoolShutDown*>(&e) == nullptr)) { ignoreException(); } } catch (...) { @@ -135,7 +135,7 @@ void ThreadPool::doWork(bool mainThread) { /* If there are no active or pending items, and the main thread is running process(), then no new items can be added. So exit. */ - if (!state->active && state->draining) { + if ((state->active == 0u) && state->draining) { quit = true; work.notify_all(); return; |