mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 21:14:33 -04:00
Make ConcurrentQueue::waitAll() const
This member function does not affect the logical state of the class. Making std::condition_variable and std::mutex data members mutable is idiomatic as these classes are thread-safe synchronization primitives.
This commit is contained in:
committed by
Luis Ángel San Martín
parent
72c78d0164
commit
05b384ed6d
@ -33,7 +33,7 @@ public:
|
||||
std::size_t cancelPending();
|
||||
|
||||
//! @brief Blocks the current thread until all enqueued jobs are completed.
|
||||
void waitAll();
|
||||
void waitAll() const;
|
||||
|
||||
private:
|
||||
//! @invariant all worker threads are joinable until the destructor is called.
|
||||
@ -42,8 +42,8 @@ private:
|
||||
std::size_t jobsLeft = 0; //!< @invariant jobsLeft >= _queue.size()
|
||||
bool bailout = false; //!< @invariant is false until the destructor is called.
|
||||
std::condition_variable jobAvailableVar;
|
||||
std::condition_variable _waitVar;
|
||||
std::mutex jobsLeftMutex;
|
||||
mutable std::condition_variable _waitVar;
|
||||
mutable std::mutex jobsLeftMutex;
|
||||
std::mutex queueMutex;
|
||||
|
||||
void nextJob();
|
||||
|
Reference in New Issue
Block a user