[lld] r302697 - Rename variables to conform to LLVM naming conventions.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Wed May 10 10:39:19 PDT 2017
Author: zturner
Date: Wed May 10 12:39:18 2017
New Revision: 302697
URL: http://llvm.org/viewvc/llvm-project?rev=302697&view=rev
Log:
Rename variables to conform to LLVM naming conventions.
Modified:
lld/trunk/include/lld/Core/TaskGroup.h
lld/trunk/lib/Core/TaskGroup.cpp
Modified: lld/trunk/include/lld/Core/TaskGroup.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/TaskGroup.h?rev=302697&r1=302696&r2=302697&view=diff
==============================================================================
--- lld/trunk/include/lld/Core/TaskGroup.h (original)
+++ lld/trunk/include/lld/Core/TaskGroup.h Wed May 10 12:39:18 2017
@@ -25,40 +25,40 @@ namespace lld {
///
/// 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<std::mutex> lock(_condMut);
- ++_count;
+ std::unique_lock<std::mutex> lock(Mutex);
+ ++Count;
}
void dec() {
- std::unique_lock<std::mutex> lock(_condMut);
- if (--_count == 0)
- _cond.notify_all();
+ std::unique_lock<std::mutex> lock(Mutex);
+ if (--Count == 0)
+ Cond.notify_all();
}
void sync() const {
- std::unique_lock<std::mutex> lock(_condMut);
- _cond.wait(lock, [&] { return _count == 0; });
+ std::unique_lock<std::mutex> 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 L;
public:
- void spawn(std::function<void()> f);
+ void spawn(std::function<void()> F);
- void sync() const { _latch.sync(); }
+ void sync() const { L.sync(); }
};
}
Modified: lld/trunk/lib/Core/TaskGroup.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/TaskGroup.cpp?rev=302697&r1=302696&r2=302697&view=diff
==============================================================================
--- lld/trunk/lib/Core/TaskGroup.cpp (original)
+++ lld/trunk/lib/Core/TaskGroup.cpp Wed May 10 12:39:18 2017
@@ -132,10 +132,10 @@ Executor *Executor::getDefaultExecutor()
#endif
}
-void TaskGroup::spawn(std::function<void()> f) {
- _latch.inc();
- Executor::getDefaultExecutor()->add([&, f] {
- f();
- _latch.dec();
+void TaskGroup::spawn(std::function<void()> F) {
+ L.inc();
+ Executor::getDefaultExecutor()->add([&, F] {
+ F();
+ L.dec();
});
}
More information about the llvm-commits
mailing list