/usr/include/stxxl/bits/common
NameSizeModeActions
addressable_queues.h60360644editdlrm
aligned_alloc.h53870644editdlrm
binary_buffer.h200630644editdlrm
cmdline.h234820644editdlrm
condition_variable.h21410644editdlrm
counting_ptr.h164040644editdlrm
error_handling.h77020644editdlrm
exceptions.h20000644editdlrm
exithandler.h14000644editdlrm
external_shared_ptr.h37600644editdlrm
is_sorted.h18180644editdlrm
log.h12650644editdlrm
mutex.h33320644editdlrm
new_alloc.h39010644editdlrm
onoff_switch.h21460644editdlrm
rand.h81910644editdlrm
seed.h8630644editdlrm
semaphore.h24490644editdlrm
settings.h9710644editdlrm
simple_vector.h46390644editdlrm
state.h16870644editdlrm
timer.h46620644editdlrm
tmeta.h29880644editdlrm
tuple.h195530644editdlrm
types.h19230644editdlrm
uint_types.h95720644editdlrm
utils.h83800644editdlrm
Edit: /usr/include/stxxl/bits/common/state.h (1687B)
/*************************************************************************** * include/stxxl/bits/common/state.h * * Part of the STXXL. See http://stxxl.sourceforge.net * * Copyright (C) 2002 Roman Dementiev * Copyright (C) 2008 Andreas Beckmann * Copyright (C) 2013 Timo Bingmann * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) **************************************************************************/ #ifndef STXXL_COMMON_STATE_HEADER #define STXXL_COMMON_STATE_HEADER #include #include #include STXXL_BEGIN_NAMESPACE template class state : private noncopyable { typedef ValueType value_type; //! mutex for condition variable mutex m_mutex; //! condition variable condition_variable m_cond; //! current state value_type m_state; public: state(const value_type& s) : m_state(s) { } void set_to(const value_type& new_state) { scoped_mutex_lock lock(m_mutex); m_state = new_state; lock.unlock(); m_cond.notify_all(); } void wait_for(const value_type& needed_state) { scoped_mutex_lock lock(m_mutex); while (needed_state != m_state) m_cond.wait(lock); } value_type operator () () { scoped_mutex_lock lock(m_mutex); return m_state; } }; STXXL_END_NAMESPACE #endif // !STXXL_COMMON_STATE_HEADER