15 #ifndef FOXXLL_COMMON_SHARED_STATE_HEADER 16 #define FOXXLL_COMMON_SHARED_STATE_HEADER 18 #include <condition_variable> 23 template <
typename ValueType =
size_t>
32 std::condition_variable
cv_;
48 std::unique_lock<std::mutex> lock(mutex_);
56 std::unique_lock<std::mutex> lock(mutex_);
57 while (needed_state != state_)
63 std::unique_lock<std::mutex> lock(mutex_);
70 #endif // !FOXXLL_COMMON_SHARED_STATE_HEADER std::condition_variable cv_
condition variable
void set_to(const value_type &new_state)
std::mutex mutex_
mutex for condition variable
shared_state & operator=(const shared_state &)=delete
non-copyable: delete assignment operator
value_type state_
current shared_state
void wait_for(const value_type &needed_state)
shared_state(const value_type &s)