1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/thread/thread.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,89 @@
1.4 +// Copyright (C) 2001-2003
1.5 +// William E. Kempf
1.6 +//
1.7 +// Distributed under the Boost Software License, Version 1.0. (See accompanying
1.8 +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
1.9 +
1.10 +#ifndef BOOST_THREAD_WEK070601_HPP
1.11 +#define BOOST_THREAD_WEK070601_HPP
1.12 +
1.13 +#include <boost/thread/detail/config.hpp>
1.14 +
1.15 +#include <boost/utility.hpp>
1.16 +#include <boost/function.hpp>
1.17 +#include <boost/thread/mutex.hpp>
1.18 +#include <list>
1.19 +#include <memory>
1.20 +
1.21 +#if defined(BOOST_HAS_PTHREADS)
1.22 +# include <pthread.h>
1.23 +# include <boost/thread/condition.hpp>
1.24 +#elif defined(BOOST_HAS_MPTASKS)
1.25 +# include <Multiprocessing.h>
1.26 +#endif
1.27 +
1.28 +namespace boost {
1.29 +
1.30 +struct xtime;
1.31 +// disable warnings about non dll import
1.32 +// see: http://www.boost.org/more/separate_compilation.html#dlls
1.33 +#ifdef BOOST_MSVC
1.34 +# pragma warning(push)
1.35 +# pragma warning(disable: 4251 4231 4660 4275)
1.36 +#endif
1.37 +class BOOST_THREAD_DECL thread : private noncopyable
1.38 +{
1.39 +public:
1.40 + thread();
1.41 + explicit thread(const function0<void>& threadfunc);
1.42 + ~thread();
1.43 +
1.44 + bool operator==(const thread& other) const;
1.45 + bool operator!=(const thread& other) const;
1.46 +
1.47 + void join();
1.48 +
1.49 + static void sleep(const xtime& xt);
1.50 + static void yield();
1.51 +
1.52 +private:
1.53 +#if defined(BOOST_HAS_WINTHREADS)
1.54 + void* m_thread;
1.55 + unsigned int m_id;
1.56 +#elif defined(BOOST_HAS_PTHREADS)
1.57 +private:
1.58 + pthread_t m_thread;
1.59 +#elif defined(BOOST_HAS_MPTASKS)
1.60 + MPQueueID m_pJoinQueueID;
1.61 + MPTaskID m_pTaskID;
1.62 +#endif
1.63 + bool m_joinable;
1.64 +};
1.65 +
1.66 +class BOOST_THREAD_DECL thread_group : private noncopyable
1.67 +{
1.68 +public:
1.69 + thread_group();
1.70 + ~thread_group();
1.71 +
1.72 + thread* create_thread(const function0<void>& threadfunc);
1.73 + void add_thread(thread* thrd);
1.74 + void remove_thread(thread* thrd);
1.75 + void join_all();
1.76 + int size();
1.77 +
1.78 +private:
1.79 + std::list<thread*> m_threads;
1.80 + mutex m_mutex;
1.81 +};
1.82 +#ifdef BOOST_MSVC
1.83 +# pragma warning(pop)
1.84 +#endif
1.85 +} // namespace boost
1.86 +
1.87 +// Change Log:
1.88 +// 8 Feb 01 WEKEMPF Initial version.
1.89 +// 1 Jun 01 WEKEMPF Added boost::thread initial implementation.
1.90 +// 3 Jul 01 WEKEMPF Redesigned boost::thread to be noncopyable.
1.91 +
1.92 +#endif // BOOST_THREAD_WEK070601_HPP