From 867055133d3f487e52dd44149f76347c2c28bf10 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 19 May 2020 18:55:58 +0100 Subject: style(3p/nix): Add braces around single-line conditionals These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber --- third_party/nix/src/libutil/thread-pool.cc | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'third_party/nix/src/libutil/thread-pool.cc') diff --git a/third_party/nix/src/libutil/thread-pool.cc b/third_party/nix/src/libutil/thread-pool.cc index ee727aacd0..a16f4c2b60 100644 --- a/third_party/nix/src/libutil/thread-pool.cc +++ b/third_party/nix/src/libutil/thread-pool.cc @@ -10,7 +10,9 @@ ThreadPool::ThreadPool(size_t _maxThreads) : maxThreads(_maxThreads) { if (!maxThreads) { maxThreads = std::thread::hardware_concurrency(); - if (!maxThreads) maxThreads = 1; + if (!maxThreads) { + maxThreads = 1; + } } DLOG(INFO) << "starting pool of " << maxThreads - 1 << " threads"; @@ -26,7 +28,9 @@ void ThreadPool::shutdown() { std::swap(workers, state->workers); } - if (workers.empty()) return; + if (workers.empty()) { + return; + } DLOG(INFO) << "reaping " << workers.size() << " worker threads"; @@ -62,7 +66,9 @@ void ThreadPool::process() { assert(quit); - if (state->exception) std::rethrow_exception(state->exception); + if (state->exception) { + std::rethrow_exception(state->exception); + } } catch (...) { /* In the exceptional case, some workers may still be @@ -76,7 +82,9 @@ void ThreadPool::process() { } void ThreadPool::doWork(bool mainThread) { - if (!mainThread) interruptCheck = [&]() { return (bool)quit; }; + if (!mainThread) { + interruptCheck = [&]() { return (bool)quit; }; + } bool didWork = false; std::exception_ptr exc; @@ -114,9 +122,13 @@ void ThreadPool::doWork(bool mainThread) { /* Wait until a work item is available or we're asked to quit. */ while (true) { - if (quit) return; + if (quit) { + return; + } - if (!state->pending.empty()) break; + if (!state->pending.empty()) { + break; + } /* If there are no active or pending items, and the main thread is running process(), then no new items -- cgit 1.4.1