diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:19:17 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 19:20:07 (GMT) |
commit | 857e44c156a1dbefcb49bb5792c4384cebd8762a (patch) | |
tree | 11947fb81ad9c502627f1b2bb8f090fb8d53c107 /3rdParty/Boost/src/boost/thread/detail | |
parent | 77d4eb7588e113beaa03f3347523b26adefdeb06 (diff) | |
download | swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.zip swift-857e44c156a1dbefcb49bb5792c4384cebd8762a.tar.bz2 |
Updated Boost to 1.42.
Diffstat (limited to '3rdParty/Boost/src/boost/thread/detail')
4 files changed, 156 insertions, 104 deletions
diff --git a/3rdParty/Boost/src/boost/thread/detail/move.hpp b/3rdParty/Boost/src/boost/thread/detail/move.hpp index 044ecda..eb21107 100644 --- a/3rdParty/Boost/src/boost/thread/detail/move.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/move.hpp @@ -41,9 +41,9 @@ namespace boost #ifndef BOOST_NO_SFINAE template<typename T> - typename enable_if<boost::is_convertible<T&,detail::thread_move_t<T> >, T >::type move(T& t) + typename enable_if<boost::is_convertible<T&,detail::thread_move_t<T> >, detail::thread_move_t<T> >::type move(T& t) { - return T(detail::thread_move_t<T>(t)); + return detail::thread_move_t<T>(t); } #endif diff --git a/3rdParty/Boost/src/boost/thread/detail/thread.hpp b/3rdParty/Boost/src/boost/thread/detail/thread.hpp index fbb895d..170801b 100644 --- a/3rdParty/Boost/src/boost/thread/detail/thread.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/thread.hpp @@ -144,6 +144,9 @@ namespace boost struct dummy; #endif public: +#ifdef __SUNPRO_CC + thread(const volatile thread&); +#endif thread(); ~thread(); @@ -201,14 +204,21 @@ namespace boost thread_info=x->thread_info; x->thread_info.reset(); } - + +#ifdef __SUNPRO_CC + thread& operator=(thread x) + { + swap(x); + return *this; + } +#else thread& operator=(detail::thread_move_t<thread> x) { thread new_thread(x); swap(new_thread); return *this; } - +#endif operator detail::thread_move_t<thread>() { return move(); @@ -339,35 +349,14 @@ namespace boost return t; } #else - inline thread move(detail::thread_move_t<thread> t) + inline detail::thread_move_t<thread> move(detail::thread_move_t<thread> t) { - return thread(t); + return t; } #endif 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(); - }; - thread::id BOOST_THREAD_DECL get_id(); void BOOST_THREAD_DECL interruption_point(); @@ -487,83 +476,6 @@ namespace boost detail::add_thread_exit_function(thread_exit_func); } } - - class thread_group: - private noncopyable - { - public: - ~thread_group() - { - for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); - it!=end; - ++it) - { - delete *it; - } - } - - template<typename F> - thread* create_thread(F threadfunc) - { - boost::lock_guard<mutex> guard(m); - std::auto_ptr<thread> new_thread(new thread(threadfunc)); - threads.push_back(new_thread.get()); - return new_thread.release(); - } - - void add_thread(thread* thrd) - { - if(thrd) - { - boost::lock_guard<mutex> guard(m); - threads.push_back(thrd); - } - } - - void remove_thread(thread* thrd) - { - boost::lock_guard<mutex> guard(m); - std::list<thread*>::iterator const it=std::find(threads.begin(),threads.end(),thrd); - if(it!=threads.end()) - { - threads.erase(it); - } - } - - void join_all() - { - boost::lock_guard<mutex> guard(m); - - for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); - it!=end; - ++it) - { - (*it)->join(); - } - } - - void interrupt_all() - { - boost::lock_guard<mutex> guard(m); - - for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); - it!=end; - ++it) - { - (*it)->interrupt(); - } - } - - size_t size() const - { - boost::lock_guard<mutex> guard(m); - return threads.size(); - } - - private: - std::list<thread*> threads; - mutable mutex m; - }; } #ifdef BOOST_MSVC diff --git a/3rdParty/Boost/src/boost/thread/detail/thread_group.hpp b/3rdParty/Boost/src/boost/thread/detail/thread_group.hpp new file mode 100644 index 0000000..823b92e --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/detail/thread_group.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_THREAD_DETAIL_THREAD_GROUP_HPP +#define BOOST_THREAD_DETAIL_THREAD_GROUP_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) +// (C) Copyright 2007-9 Anthony Williams + +#include <list> +#include <boost/thread/shared_mutex.hpp> +#include <boost/thread/mutex.hpp> + +#include <boost/config/abi_prefix.hpp> + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4251) +#endif + +namespace boost +{ + class thread_group: + private noncopyable + { + public: + ~thread_group() + { + for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); + it!=end; + ++it) + { + delete *it; + } + } + + template<typename F> + thread* create_thread(F threadfunc) + { + boost::lock_guard<shared_mutex> guard(m); + std::auto_ptr<thread> new_thread(new thread(threadfunc)); + threads.push_back(new_thread.get()); + return new_thread.release(); + } + + void add_thread(thread* thrd) + { + if(thrd) + { + boost::lock_guard<shared_mutex> guard(m); + threads.push_back(thrd); + } + } + + void remove_thread(thread* thrd) + { + boost::lock_guard<shared_mutex> guard(m); + std::list<thread*>::iterator const it=std::find(threads.begin(),threads.end(),thrd); + if(it!=threads.end()) + { + threads.erase(it); + } + } + + void join_all() + { + boost::shared_lock<shared_mutex> guard(m); + + for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); + it!=end; + ++it) + { + (*it)->join(); + } + } + + void interrupt_all() + { + boost::shared_lock<shared_mutex> guard(m); + + for(std::list<thread*>::iterator it=threads.begin(),end=threads.end(); + it!=end; + ++it) + { + (*it)->interrupt(); + } + } + + size_t size() const + { + boost::shared_lock<shared_mutex> guard(m); + return threads.size(); + } + + private: + std::list<thread*> threads; + mutable shared_mutex m; + }; +} + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include <boost/config/abi_suffix.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp b/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp new file mode 100644 index 0000000..60c0e65 --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp @@ -0,0 +1,35 @@ +#ifndef BOOST_THREAD_DETAIL_THREAD_INTERRUPTION_HPP +#define BOOST_THREAD_DETAIL_THREAD_INTERRUPTION_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) +// (C) Copyright 2007-9 Anthony Williams + +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 |