Index: boost/thread/pthread/shared_mutex.hpp =================================================================== --- boost/thread/pthread/shared_mutex.hpp (revision 47043) +++ boost/thread/pthread/shared_mutex.hpp (working copy) @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include Index: boost/thread/detail/interruption_control.hpp =================================================================== --- boost/thread/detail/interruption_control.hpp (revision 0) +++ boost/thread/detail/interruption_control.hpp (revision 0) @@ -0,0 +1,35 @@ +#ifndef BOOST_THREAD_DETAIL_INTERRUPTION_CONTROL_HPP +#define BOOST_THREAD_DETAIL_INTERRUPTION_CONTROL_HPP +// 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) + +#include + +namespace boost +{ + namespace this_thread + { + class BOOST_THREAD_DECL disable_interruption + { + disable_interruption(const disable_interruption&); + disable_interruption& operator=(const disable_interruption&); + + bool interruption_was_enabled; + friend class restore_interruption; + public: + disable_interruption(); + ~disable_interruption(); + }; + + class BOOST_THREAD_DECL restore_interruption + { + restore_interruption(const restore_interruption&); + restore_interruption& operator=(const restore_interruption&); + public: + explicit restore_interruption(disable_interruption& d); + ~restore_interruption(); + }; + } +} +#endif Index: boost/thread/detail/thread.hpp =================================================================== --- boost/thread/detail/thread.hpp (revision 47043) +++ boost/thread/detail/thread.hpp (working copy) @@ -9,8 +9,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -338,6 +340,7 @@ namespace this_thread { +#if 0 // moved to interruption_control.hpp class BOOST_THREAD_DECL disable_interruption { disable_interruption(const disable_interruption&); @@ -358,6 +361,7 @@ explicit restore_interruption(disable_interruption& d); ~restore_interruption(); }; +#endif thread::id BOOST_THREAD_DECL get_id(); @@ -496,7 +500,7 @@ template thread* create_thread(F threadfunc) { - boost::lock_guard guard(m); + boost::lock_guard guard(m); std::auto_ptr new_thread(new thread(threadfunc)); threads.push_back(new_thread.get()); return new_thread.release(); @@ -506,14 +510,14 @@ { if(thrd) { - boost::lock_guard guard(m); + boost::lock_guard guard(m); threads.push_back(thrd); } } void remove_thread(thread* thrd) { - boost::lock_guard guard(m); + boost::lock_guard guard(m); std::list::iterator const it=std::find(threads.begin(),threads.end(),thrd); if(it!=threads.end()) { @@ -523,7 +527,7 @@ void join_all() { - boost::lock_guard guard(m); + boost::shared_lock guard(m); for(std::list::iterator it=threads.begin(),end=threads.end(); it!=end; @@ -535,7 +539,7 @@ void interrupt_all() { - boost::lock_guard guard(m); + boost::shared_lock guard(m); for(std::list::iterator it=threads.begin(),end=threads.end(); it!=end; @@ -547,13 +551,13 @@ size_t size() const { - boost::lock_guard guard(m); + boost::shared_lock guard(m); return threads.size(); } private: std::list threads; - mutable mutex m; + mutable shared_mutex m; }; }