diff options
Diffstat (limited to 'src/common/thread.h')
-rw-r--r-- | src/common/thread.h | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/common/thread.h b/src/common/thread.h index 9465e1de7..6cbdb96a3 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -60,12 +60,12 @@ private: class Barrier { public: - explicit Barrier(size_t count_) : count(count_), waiting(0), generation(0) {} + explicit Barrier(std::size_t count_) : count(count_), waiting(0), generation(0) {} /// Blocks until all "count" threads have called Sync() void Sync() { std::unique_lock<std::mutex> lk(mutex); - const size_t current_generation = generation; + const std::size_t current_generation = generation; if (++waiting == count) { generation++; @@ -80,21 +80,13 @@ public: private: std::condition_variable condvar; std::mutex mutex; - const size_t count; - size_t waiting; - size_t generation; // Incremented once each time the barrier is used + const std::size_t count; + std::size_t waiting; + std::size_t generation; // Incremented once each time the barrier is used }; void SleepCurrentThread(int ms); void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms - -// Use this function during a spin-wait to make the current thread -// relax while another thread is working. This may be more efficient -// than using events because event functions use kernel calls. -inline void YieldCPU() { - std::this_thread::yield(); -} - void SetCurrentThreadName(const char* name); } // namespace Common |