Index: lld/include/lld/Core/TaskGroup.h =================================================================== --- lld/include/lld/Core/TaskGroup.h +++ lld/include/lld/Core/TaskGroup.h @@ -25,40 +25,39 @@ /// /// Calling dec() on a Latch with a count of 0 has undefined behaivor. class Latch { - uint32_t _count; - mutable std::mutex _condMut; - mutable std::condition_variable _cond; + uint32_t Count; + mutable std::mutex Mutex; + mutable std::condition_variable Cond; public: - explicit Latch(uint32_t count = 0) : _count(count) {} + explicit Latch(uint32_t Count = 0) : Count(Count) {} ~Latch() { sync(); } void inc() { - std::unique_lock lock(_condMut); - ++_count; + std::unique_lock Lock(Mutex); + ++Count; } void dec() { - std::unique_lock lock(_condMut); - if (--_count == 0) - _cond.notify_all(); + std::unique_lock Lock(Mutex); + if (--Count == 0) + Cond.notify_all(); } void sync() const { - std::unique_lock lock(_condMut); - _cond.wait(lock, [&] { return _count == 0; }); + std::unique_lock Lock(Mutex); + Cond.wait(Lock, [&] { return Count == 0; }); } }; /// \brief Allows launching a number of tasks and waiting for them to finish /// either explicitly via sync() or implicitly on destruction. class TaskGroup { - Latch _latch; + Latch Done; public: void spawn(std::function f); - - void sync() const { _latch.sync(); } + void sync() const { Done.sync(); } }; } Index: lld/lib/Core/TaskGroup.cpp =================================================================== --- lld/lib/Core/TaskGroup.cpp +++ lld/lib/Core/TaskGroup.cpp @@ -66,8 +66,8 @@ }; Executor *Executor::getDefaultExecutor() { - static ConcRTExecutor exec; - return &exec; + static ConcRTExecutor Exec; + return &Exec; } #else @@ -81,9 +81,8 @@ // Spawn all but one of the threads in another thread as spawning threads // can take a while. std::thread([&, ThreadCount] { - for (size_t i = 1; i < ThreadCount; ++i) { + for (size_t I = 1; I < ThreadCount; ++I) std::thread([=] { work(); }).detach(); - } work(); }).detach(); } @@ -126,16 +125,16 @@ }; Executor *Executor::getDefaultExecutor() { - static ThreadPoolExecutor exec; - return &exec; + static ThreadPoolExecutor Exec; + return &Exec; } #endif } -void TaskGroup::spawn(std::function f) { - _latch.inc(); - Executor::getDefaultExecutor()->add([&, f] { - f(); - _latch.dec(); +void TaskGroup::spawn(std::function F) { + Done.inc(); + Executor::getDefaultExecutor()->add([&, F] { + F(); + Done.dec(); }); }