/usr/include/boost/thread
NameSizeModeActions
concurrent_queues/-0755rm
csbl/-0755rm
detail/-0755rm
executors/-0755rm
experimental/-0755rm
futures/-0755rm
pthread/-0755rm
v2/-0755rm
win32/-0755rm
barrier.hpp74210644editdlrm
caller_context.hpp15260644editdlrm
completion_latch.hpp65790644editdlrm
condition.hpp4900644editdlrm
condition_variable.hpp6340644editdlrm
cv_status.hpp5310644editdlrm
exceptional_ptr.hpp10980644editdlrm
exceptions.hpp62860644editdlrm
executor.hpp4760644editdlrm
externally_locked.hpp107920644editdlrm
externally_locked_stream.hpp47840644editdlrm
future.hpp2037920644editdlrm
interruption.hpp5960644editdlrm
is_locked_by_this_thread.hpp10620644editdlrm
latch.hpp49670644editdlrm
lockable_adapter.hpp60430644editdlrm
lockable_concepts.hpp41140644editdlrm
lockable_traits.hpp78530644editdlrm
locks.hpp5720644editdlrm
lock_algorithms.hpp132010644editdlrm
lock_concepts.hpp47920644editdlrm
lock_factories.hpp23170644editdlrm
lock_guard.hpp22900644editdlrm
lock_options.hpp7010644editdlrm
lock_traits.hpp12340644editdlrm
lock_types.hpp344180644editdlrm
mutex.hpp11660644editdlrm
null_mutex.hpp63460644editdlrm
once.hpp13240644editdlrm
ostream_buffer.hpp9250644editdlrm
poly_lockable.hpp21000644editdlrm
poly_lockable_adapter.hpp21240644editdlrm
poly_shared_lockable.hpp58070644editdlrm
poly_shared_lockable_adapter.hpp47920644editdlrm
recursive_mutex.hpp15350644editdlrm
reverse_lock.hpp13160644editdlrm
scoped_thread.hpp85470644editdlrm
shared_lock_guard.hpp11920644editdlrm
shared_mutex.hpp14000644editdlrm
strict_lock.hpp62460644editdlrm
synchronized_value.hpp311100644editdlrm
sync_bounded_queue.hpp5950644editdlrm
sync_queue.hpp5710644editdlrm
testable_mutex.hpp39250644editdlrm
thread.hpp3850644editdlrm
thread_functors.hpp13660644editdlrm
thread_guard.hpp10690644editdlrm
thread_only.hpp8030644editdlrm
thread_pool.hpp5310644editdlrm
thread_time.hpp15900644editdlrm
tss.hpp26030644editdlrm
user_scheduler.hpp52220644editdlrm
with_lock_guard.hpp60520644editdlrm
xtime.hpp23900644editdlrm
Edit: /usr/include/boost/thread/strict_lock.hpp (6246B)
// 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) // (C) Copyright 2008-2009,2012 Vicente J. Botet Escriba #ifndef BOOST_THREAD_STRICT_LOCK_HPP #define BOOST_THREAD_STRICT_LOCK_HPP #include #include #include #include #include #include #include #include #include #include #include namespace boost { //[strict_lock template class strict_lock { BOOST_CONCEPT_ASSERT(( BasicLockable )); public: typedef Lockable mutex_type; // construct/copy/destroy: BOOST_THREAD_NO_COPYABLE( strict_lock) /** * Constructor from a mutex reference. * * @param mtx the mutex to lock. * * __Effects: Stores a reference to the mutex to lock and locks it. * __Throws: Any exception BasicMutex::lock() can throw. */ explicit strict_lock(mutex_type& mtx) : mtx_(mtx) { mtx.lock(); } /*< locks on construction >*/ #if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST strict_lock(std::initializer_list > l_) : mtx_(*(const_cast*>(l_.begin())->m)) { mtx_.lock(); } #endif /** * Destructor * * __Effects: unlocks the stored mutex. * * __Throws */ ~strict_lock() { mtx_.unlock(); } /*< unlocks on destruction >*/ // observers /** * @return the owned mutex. */ mutex_type* mutex() const BOOST_NOEXCEPT { return &mtx_; } /** * @return whether this lock is locking a mutex. */ bool owns_lock() const BOOST_NOEXCEPT { return true; } /** * @return whether this lock is locking that mutex. */ bool owns_lock(const mutex_type* l) const BOOST_NOEXCEPT { return l == mutex(); } /*< strict locks specific function >*/ //BOOST_ADRESS_OF_DELETE(strict_lock) /*< disable aliasing >*/ //BOOST_HEAP_ALLOCATION_DELETE(strict_lock) /*< disable heap allocation >*/ /*< no possibility to unlock >*/ private: mutex_type& mtx_; }; //] template struct is_strict_lock_sur_parole > : true_type { }; /** * A nested strict lock is a scoped lock guard ensuring the mutex is locked on its * scope, by taking ownership of an nesting lock, locking the mutex on construction if not already locked * and restoring the ownership to the nesting lock on destruction. */ //[nested_strict_lock template class nested_strict_lock { BOOST_CONCEPT_ASSERT(( BasicLock )); /*< The Lock must be a movable lock >*/ public: typedef typename Lock::mutex_type mutex_type; /*< Name the lockable type locked by Lock >*/ BOOST_THREAD_NO_COPYABLE( nested_strict_lock) /** * Constructor from a nesting @c Lock. * * @param lk the nesting lock * * __Requires: lk.mutex() != null_ptr * __Effects: Stores the reference to the lock parameter and takes ownership on it. * If the lock doesn't owns the mutex @c mtx lock it. * __Postconditions: @c owns_lock(lk.mutex()) * __StrongException * __Throws: * * - lock_error when BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED is defined and lk.mutex() == null_ptr * * - Any exception that @c lk.lock() can throw. * */ explicit nested_strict_lock(Lock& lk) : lk_(lk) /*< Store reference to lk >*/ { /*< Define BOOST_THREAD_DONT_CHECK_PRECONDITIONS if you don't want to check lk ownership >*/ BOOST_THREAD_ASSERT_PRECONDITION( lk.mutex() != 0, lock_error() ); if (!lk.owns_lock()) lk.lock(); /*< ensures it is locked >*/ tmp_lk_ = move(lk); /*< Move ownership to temporary lk >*/ } #if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST nested_strict_lock(std::initializer_list > l_) : lk_(*(const_cast*>(l_.begin())->m)) { /*< Define BOOST_THREAD_DONT_CHECK_PRECONDITIONS if you don't want to check lk ownership >*/ BOOST_THREAD_ASSERT_PRECONDITION( lk_.mutex() != 0, lock_error() ); if (!lk_.owns_lock()) lk_.lock(); /*< ensures it is locked >*/ tmp_lk_ = move(lk_); /*< Move ownership to temporary lk >*/ } #endif /** * Destructor * * __Effects: Restores ownership to the nesting lock. */ ~nested_strict_lock()BOOST_NOEXCEPT { lk_ = move(tmp_lk_); /*< Move ownership to nesting lock >*/ } // observers /** * return @c the owned mutex. */ mutex_type* mutex() const BOOST_NOEXCEPT { return tmp_lk_.mutex(); } /** * @return whether this lock is locking a mutex. */ bool owns_lock() const BOOST_NOEXCEPT { return true; } /** * @return whether if this lock is locking that mutex. */ bool owns_lock(mutex_type const* l) const BOOST_NOEXCEPT { return l == mutex(); } //BOOST_ADRESS_OF_DELETE(nested_strict_lock) //BOOST_HEAP_ALLOCATEION_DELETE(nested_strict_lock) private: Lock& lk_; Lock tmp_lk_; }; //] template struct is_strict_lock_sur_parole > : true_type { }; #if ! defined BOOST_THREAD_NO_MAKE_STRICT_LOCK template strict_lock make_strict_lock(Lockable& mtx) { return { thread_detail::lockable_wrapper(mtx) }; } template nested_strict_lock make_nested_strict_lock(Lock& lk) { return { thread_detail::lockable_wrapper(lk) }; } #endif } #include #endif