diff options
Diffstat (limited to '3rdParty/Boost/boost/thread/detail')
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/config.hpp | 94 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/move.hpp | 60 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/platform.hpp | 71 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/thread.hpp | 575 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/thread_heap_alloc.hpp | 23 | ||||
-rw-r--r-- | 3rdParty/Boost/boost/thread/detail/tss_hooks.hpp | 82 |
6 files changed, 905 insertions, 0 deletions
diff --git a/3rdParty/Boost/boost/thread/detail/config.hpp b/3rdParty/Boost/boost/thread/detail/config.hpp new file mode 100644 index 0000000..7661507 --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/config.hpp @@ -0,0 +1,94 @@ +// Copyright (C) 2001-2003 +// William E. Kempf +// +// 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 BOOST_THREAD_CONFIG_WEK01032003_HPP +#define BOOST_THREAD_CONFIG_WEK01032003_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(__BORLANDC__, < 0x600) +# pragma warn -8008 // Condition always true/false +# pragma warn -8080 // Identifier declared but never used +# pragma warn -8057 // Parameter never used +# pragma warn -8066 // Unreachable code +#endif + +#include "platform.hpp" + +// compatibility with the rest of Boost's auto-linking code: +#if defined(BOOST_THREAD_DYN_DLL) || defined(BOOST_ALL_DYN_LINK) +# undef BOOST_THREAD_USE_LIB +# define BOOST_THREAD_USE_DLL +#endif + +#if defined(BOOST_THREAD_BUILD_DLL) //Build dll +#elif defined(BOOST_THREAD_BUILD_LIB) //Build lib +#elif defined(BOOST_THREAD_USE_DLL) //Use dll +#elif defined(BOOST_THREAD_USE_LIB) //Use lib +#else //Use default +# if defined(BOOST_THREAD_PLATFORM_WIN32) +# if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) + //For compilers supporting auto-tss cleanup + //with Boost.Threads lib, use Boost.Threads lib +# define BOOST_THREAD_USE_LIB +# else + //For compilers not yet supporting auto-tss cleanup + //with Boost.Threads lib, use Boost.Threads dll +# define BOOST_THREAD_USE_DLL +# endif +# else +# define BOOST_THREAD_USE_LIB +# endif +#endif + +#if defined(BOOST_HAS_DECLSPEC) +# if defined(BOOST_THREAD_BUILD_DLL) //Build dll +# define BOOST_THREAD_DECL __declspec(dllexport) +# elif defined(BOOST_THREAD_USE_DLL) //Use dll +# define BOOST_THREAD_DECL __declspec(dllimport) +# else +# define BOOST_THREAD_DECL +# endif +#else +# define BOOST_THREAD_DECL +#endif // BOOST_HAS_DECLSPEC + +// +// Automatically link to the correct build variant where possible. +// +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_THREAD_NO_LIB) && !defined(BOOST_THREAD_BUILD_DLL) && !defined(BOOST_THREAD_BUILD_LIB) +// +// Tell the autolink to link dynamically, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#if defined(BOOST_THREAD_USE_DLL) +# define BOOST_DYN_LINK +#endif +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#if defined(BOOST_THREAD_LIB_NAME) +# define BOOST_LIB_NAME BOOST_THREAD_LIB_NAME +#else +# define BOOST_LIB_NAME boost_thread +#endif +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled + +#endif // BOOST_THREAD_CONFIG_WEK1032003_HPP + +// Change Log: +// 22 Jan 05 Roland Schwarz (speedsnail) +// Usage of BOOST_HAS_DECLSPEC macro. +// Default again is static lib usage. +// BOOST_DYN_LINK only defined when autolink included. diff --git a/3rdParty/Boost/boost/thread/detail/move.hpp b/3rdParty/Boost/boost/thread/detail/move.hpp new file mode 100644 index 0000000..044ecda --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/move.hpp @@ -0,0 +1,60 @@ +// 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-8 Anthony Williams + +#ifndef BOOST_THREAD_MOVE_HPP +#define BOOST_THREAD_MOVE_HPP + +#ifndef BOOST_NO_SFINAE +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_convertible.hpp> +#endif + +#include <boost/config/abi_prefix.hpp> + +namespace boost +{ + namespace detail + { + template<typename T> + struct thread_move_t + { + T& t; + explicit thread_move_t(T& t_): + t(t_) + {} + + T& operator*() const + { + return t; + } + + T* operator->() const + { + return &t; + } + private: + void operator=(thread_move_t&); + }; + } + +#ifndef BOOST_NO_SFINAE + template<typename T> + typename enable_if<boost::is_convertible<T&,detail::thread_move_t<T> >, T >::type move(T& t) + { + return T(detail::thread_move_t<T>(t)); + } +#endif + + template<typename T> + detail::thread_move_t<T> move(detail::thread_move_t<T> t) + { + return t; + } + +} + +#include <boost/config/abi_suffix.hpp> + +#endif diff --git a/3rdParty/Boost/boost/thread/detail/platform.hpp b/3rdParty/Boost/boost/thread/detail/platform.hpp new file mode 100644 index 0000000..4a37cf3 --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/platform.hpp @@ -0,0 +1,71 @@ +// Copyright 2006 Roland Schwarz. +// (C) Copyright 2007 Anthony Williams +// 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) +// +// This work is a reimplementation along the design and ideas +// of William E. Kempf. + +#ifndef BOOST_THREAD_RS06040501_HPP +#define BOOST_THREAD_RS06040501_HPP + +// fetch compiler and platform configuration +#include <boost/config.hpp> + +// insist on threading support being available: +#include <boost/config/requires_threads.hpp> + +// choose platform +#if defined(linux) || defined(__linux) || defined(__linux__) +# define BOOST_THREAD_LINUX +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) +# define BOOST_THREAD_BSD +#elif defined(sun) || defined(__sun) +# define BOOST_THREAD_SOLARIS +#elif defined(__sgi) +# define BOOST_THREAD_IRIX +#elif defined(__hpux) +# define BOOST_THREAD_HPUX +#elif defined(__CYGWIN__) +# define BOOST_THREAD_CYGWIN +#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) +# define BOOST_THREAD_WIN32 +#elif defined(__BEOS__) +# define BOOST_THREAD_BEOS +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +# define BOOST_THREAD_MACOS +#elif defined(__IBMCPP__) || defined(_AIX) +# define BOOST_THREAD_AIX +#elif defined(__amigaos__) +# define BOOST_THREAD_AMIGAOS +#elif defined(__QNXNTO__) +# define BOOST_THREAD_QNXNTO +#elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) +# if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_THREAD_POSIX) +# define BOOST_THREAD_POSIX +# endif +#endif + +// For every supported platform add a new entry into the dispatch table below. +// BOOST_THREAD_POSIX is tested first, so on platforms where posix and native +// threading is available, the user may choose, by defining BOOST_THREAD_POSIX +// in her source. If a platform is known to support pthreads and no native +// port of boost_thread is available just specify "pthread" in the +// dispatcher table. If there is no entry for a platform but pthreads is +// available on the platform, pthread is choosen as default. If nothing is +// available the preprocessor will fail with a diagnostic message. + +#if defined(BOOST_THREAD_POSIX) +# define BOOST_THREAD_PLATFORM_PTHREAD +#else +# if defined(BOOST_THREAD_WIN32) +# define BOOST_THREAD_PLATFORM_WIN32 +# elif defined(BOOST_HAS_PTHREADS) +# define BOOST_THREAD_PLATFORM_PTHREAD +# else +# error "Sorry, no boost threads are available for this platform." +# endif +#endif + +#endif // BOOST_THREAD_RS06040501_HPP diff --git a/3rdParty/Boost/boost/thread/detail/thread.hpp b/3rdParty/Boost/boost/thread/detail/thread.hpp new file mode 100644 index 0000000..fbb895d --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/thread.hpp @@ -0,0 +1,575 @@ +#ifndef BOOST_THREAD_THREAD_COMMON_HPP +#define BOOST_THREAD_THREAD_COMMON_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-8 Anthony Williams + +#include <boost/thread/exceptions.hpp> +#include <ostream> +#include <boost/thread/detail/move.hpp> +#include <boost/thread/mutex.hpp> +#include <boost/thread/xtime.hpp> +#include <boost/thread/detail/thread_heap_alloc.hpp> +#include <boost/utility.hpp> +#include <boost/assert.hpp> +#include <list> +#include <algorithm> +#include <boost/ref.hpp> +#include <boost/cstdint.hpp> +#include <boost/bind.hpp> +#include <stdlib.h> +#include <memory> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/remove_reference.hpp> + +#include <boost/config/abi_prefix.hpp> + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4251) +#endif + +namespace boost +{ + namespace detail + { + template<typename F> + class thread_data: + public detail::thread_data_base + { + public: +#ifdef BOOST_HAS_RVALUE_REFS + thread_data(F&& f_): + f(static_cast<F&&>(f_)) + {} +#else + thread_data(F f_): + f(f_) + {} + thread_data(detail::thread_move_t<F> f_): + f(f_) + {} +#endif + void run() + { + f(); + } + private: + F f; + + void operator=(thread_data&); + thread_data(thread_data&); + }; + + template<typename F> + class thread_data<boost::reference_wrapper<F> >: + public detail::thread_data_base + { + private: + F& f; + + void operator=(thread_data&); + thread_data(thread_data&); + public: + thread_data(boost::reference_wrapper<F> f_): + f(f_) + {} + + void run() + { + f(); + } + }; + + template<typename F> + class thread_data<const boost::reference_wrapper<F> >: + public detail::thread_data_base + { + private: + F& f; + void operator=(thread_data&); + thread_data(thread_data&); + public: + thread_data(const boost::reference_wrapper<F> f_): + f(f_) + {} + + void run() + { + f(); + } + }; + } + + class BOOST_THREAD_DECL thread + { + private: + thread(thread&); + thread& operator=(thread&); + + void release_handle(); + + mutable boost::mutex thread_info_mutex; + detail::thread_data_ptr thread_info; + + void start_thread(); + + explicit thread(detail::thread_data_ptr data); + + detail::thread_data_ptr get_thread_info() const; + +#ifdef BOOST_HAS_RVALUE_REFS + template<typename F> + static inline detail::thread_data_ptr make_thread_info(F&& f) + { + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename boost::remove_reference<F>::type> >(static_cast<F&&>(f))); + } + static inline detail::thread_data_ptr make_thread_info(void (*f)()) + { + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<void(*)()> >(f)); + } +#else + template<typename F> + static inline detail::thread_data_ptr make_thread_info(F f) + { + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f)); + } + template<typename F> + static inline detail::thread_data_ptr make_thread_info(boost::detail::thread_move_t<F> f) + { + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f)); + } + + struct dummy; +#endif + public: + thread(); + ~thread(); + +#ifdef BOOST_HAS_RVALUE_REFS + template <class F> + thread(F&& f): + thread_info(make_thread_info(static_cast<F&&>(f))) + { + start_thread(); + } + + thread(thread&& other) + { + thread_info.swap(other.thread_info); + } + + thread& operator=(thread&& other) + { + thread_info=other.thread_info; + other.thread_info.reset(); + return *this; + } + + thread&& move() + { + return static_cast<thread&&>(*this); + } + +#else +#ifdef BOOST_NO_SFINAE + template <class F> + explicit thread(F f): + thread_info(make_thread_info(f)) + { + start_thread(); + } +#else + template <class F> + explicit thread(F f,typename disable_if<boost::is_convertible<F&,detail::thread_move_t<F> >, dummy* >::type=0): + thread_info(make_thread_info(f)) + { + start_thread(); + } +#endif + + template <class F> + explicit thread(detail::thread_move_t<F> f): + thread_info(make_thread_info(f)) + { + start_thread(); + } + + thread(detail::thread_move_t<thread> x) + { + thread_info=x->thread_info; + x->thread_info.reset(); + } + + thread& operator=(detail::thread_move_t<thread> x) + { + thread new_thread(x); + swap(new_thread); + return *this; + } + + operator detail::thread_move_t<thread>() + { + return move(); + } + + detail::thread_move_t<thread> move() + { + detail::thread_move_t<thread> x(*this); + return x; + } + +#endif + + template <class F,class A1> + thread(F f,A1 a1): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1))) + { + start_thread(); + } + template <class F,class A1,class A2> + thread(F f,A1 a1,A2 a2): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3> + thread(F f,A1 a1,A2 a2,A3 a3): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4,class A5> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4,class A5,class A6> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7,a8))) + { + start_thread(); + } + + template <class F,class A1,class A2,class A3,class A4,class A5,class A6,class A7,class A8,class A9> + thread(F f,A1 a1,A2 a2,A3 a3,A4 a4,A5 a5,A6 a6,A7 a7,A8 a8,A9 a9): + thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1,a2,a3,a4,a5,a6,a7,a8,a9))) + { + start_thread(); + } + + void swap(thread& x) + { + thread_info.swap(x.thread_info); + } + + class id; + id get_id() const; + + + bool joinable() const; + void join(); + bool timed_join(const system_time& wait_until); + + template<typename TimeDuration> + inline bool timed_join(TimeDuration const& rel_time) + { + return timed_join(get_system_time()+rel_time); + } + void detach(); + + static unsigned hardware_concurrency(); + + typedef detail::thread_data_base::native_handle_type native_handle_type; + native_handle_type native_handle(); + + // backwards compatibility + bool operator==(const thread& other) const; + bool operator!=(const thread& other) const; + + static inline void yield() + { + this_thread::yield(); + } + + static inline void sleep(const system_time& xt) + { + this_thread::sleep(xt); + } + + // extensions + void interrupt(); + bool interruption_requested() const; + }; + + inline void swap(thread& lhs,thread& rhs) + { + return lhs.swap(rhs); + } + +#ifdef BOOST_HAS_RVALUE_REFS + inline thread&& move(thread&& t) + { + return t; + } +#else + inline thread move(detail::thread_move_t<thread> t) + { + return thread(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(); + bool BOOST_THREAD_DECL interruption_enabled(); + bool BOOST_THREAD_DECL interruption_requested(); + + inline void sleep(xtime const& abs_time) + { + sleep(system_time(abs_time)); + } + } + + class thread::id + { + private: + detail::thread_data_ptr thread_data; + + id(detail::thread_data_ptr thread_data_): + thread_data(thread_data_) + {} + friend class thread; + friend id this_thread::get_id(); + public: + id(): + thread_data() + {} + + bool operator==(const id& y) const + { + return thread_data==y.thread_data; + } + + bool operator!=(const id& y) const + { + return thread_data!=y.thread_data; + } + + bool operator<(const id& y) const + { + return thread_data<y.thread_data; + } + + bool operator>(const id& y) const + { + return y.thread_data<thread_data; + } + + bool operator<=(const id& y) const + { + return !(y.thread_data<thread_data); + } + + bool operator>=(const id& y) const + { + return !(thread_data<y.thread_data); + } + + template<class charT, class traits> + friend std::basic_ostream<charT, traits>& + operator<<(std::basic_ostream<charT, traits>& os, const id& x) + { + if(x.thread_data) + { + return os<<x.thread_data; + } + else + { + return os<<"{Not-any-thread}"; + } + } + }; + + inline bool thread::operator==(const thread& other) const + { + return get_id()==other.get_id(); + } + + inline bool thread::operator!=(const thread& other) const + { + return get_id()!=other.get_id(); + } + + namespace detail + { + struct thread_exit_function_base + { + virtual ~thread_exit_function_base() + {} + virtual void operator()() const=0; + }; + + template<typename F> + struct thread_exit_function: + thread_exit_function_base + { + F f; + + thread_exit_function(F f_): + f(f_) + {} + + void operator()() const + { + f(); + } + }; + + void add_thread_exit_function(thread_exit_function_base*); + } + + namespace this_thread + { + template<typename F> + void at_thread_exit(F f) + { + detail::thread_exit_function_base* const thread_exit_func=detail::heap_new<detail::thread_exit_function<F> >(f); + 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 +#pragma warning(pop) +#endif + +#include <boost/config/abi_suffix.hpp> + +#endif diff --git a/3rdParty/Boost/boost/thread/detail/thread_heap_alloc.hpp b/3rdParty/Boost/boost/thread/detail/thread_heap_alloc.hpp new file mode 100644 index 0000000..2f9bfd5 --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/thread_heap_alloc.hpp @@ -0,0 +1,23 @@ +#ifndef BOOST_THREAD_THREAD_HEAP_ALLOC_HPP +#define BOOST_THREAD_THREAD_HEAP_ALLOC_HPP + +// thread_heap_alloc.hpp +// +// (C) Copyright 2008 Anthony Williams +// +// 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 <boost/thread/detail/platform.hpp> + +#if defined(BOOST_THREAD_PLATFORM_WIN32) +#include <boost/thread/win32/thread_heap_alloc.hpp> +#elif defined(BOOST_THREAD_PLATFORM_PTHREAD) +#include <boost/thread/pthread/thread_heap_alloc.hpp> +#else +#error "Boost threads unavailable on this platform" +#endif + + +#endif diff --git a/3rdParty/Boost/boost/thread/detail/tss_hooks.hpp b/3rdParty/Boost/boost/thread/detail/tss_hooks.hpp new file mode 100644 index 0000000..c496844 --- /dev/null +++ b/3rdParty/Boost/boost/thread/detail/tss_hooks.hpp @@ -0,0 +1,82 @@ +// (C) Copyright Michael Glassford 2004. +// Use, modification and distribution are subject to 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) + +#if !defined(BOOST_TLS_HOOKS_HPP) +#define BOOST_TLS_HOOKS_HPP + +#include <boost/thread/detail/config.hpp> + +#include <boost/config/abi_prefix.hpp> + +#if defined(BOOST_HAS_WINTHREADS) + + typedef void (__cdecl *thread_exit_handler)(void); + + extern "C" BOOST_THREAD_DECL int at_thread_exit( + thread_exit_handler exit_handler + ); + //Add a function to the list of functions that will + //be called when a thread is about to exit. + //Currently only implemented for Win32, but should + //later be implemented for all platforms. + //Used by Win32 implementation of Boost.Threads + //tss to perform cleanup. + //Like the C runtime library atexit() function, + //which it mimics, at_thread_exit() returns + //zero if successful and a nonzero + //value if an error occurs. + +#endif //defined(BOOST_HAS_WINTHREADS) + +#if defined(BOOST_HAS_WINTHREADS) + + extern "C" BOOST_THREAD_DECL void on_process_enter(void); + //Function to be called when the exe or dll + //that uses Boost.Threads first starts + //or is first loaded. + //Should be called only before the first call to + //on_thread_enter(). + //Called automatically by Boost.Threads when + //a method for doing so has been discovered. + //May be omitted; may be called multiple times. + + extern "C" BOOST_THREAD_DECL void on_process_exit(void); + //Function to be called when the exe or dll + //that uses Boost.Threads first starts + //or is first loaded. + //Should be called only after the last call to + //on_exit_thread(). + //Called automatically by Boost.Threads when + //a method for doing so has been discovered. + //Must not be omitted; may be called multiple times. + + extern "C" BOOST_THREAD_DECL void on_thread_enter(void); + //Function to be called just after a thread starts + //in an exe or dll that uses Boost.Threads. + //Must be called in the context of the thread + //that is starting. + //Called automatically by Boost.Threads when + //a method for doing so has been discovered. + //May be omitted; may be called multiple times. + + extern "C" BOOST_THREAD_DECL void __cdecl on_thread_exit(void); + //Function to be called just be fore a thread ends + //in an exe or dll that uses Boost.Threads. + //Must be called in the context of the thread + //that is ending. + //Called automatically by Boost.Threads when + //a method for doing so has been discovered. + //Must not be omitted; may be called multiple times. + + extern "C" void tss_cleanup_implemented(void); + //Dummy function used both to detect whether tss cleanup + //cleanup has been implemented and to force + //it to be linked into the Boost.Threads library. + +#endif //defined(BOOST_HAS_WINTHREADS) + +#include <boost/config/abi_suffix.hpp> + +#endif //!defined(BOOST_TLS_HOOKS_HPP) |