00001 // 00002 // thread.hpp 00003 // ~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) 00006 // 00007 // Distributed under the Boost Software License, Version 1.0. (See accompanying 00008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 00009 // 00010 00011 #ifndef ASIO_THREAD_HPP 00012 #define ASIO_THREAD_HPP 00013 00014 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 00015 # pragma once 00016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 00017 00018 #include "asio/detail/push_options.hpp" 00019 00020 #include "asio/detail/noncopyable.hpp" 00021 #include "asio/detail/thread.hpp" 00022 00023 namespace asio { 00024 00026 00047 class thread 00048 : private noncopyable 00049 { 00050 public: 00052 00059 template <typename Function> 00060 explicit thread(Function f) 00061 : impl_(f, asio::detail::thread::external) 00062 { 00063 } 00064 00066 ~thread() 00067 { 00068 } 00069 00071 00078 void join() 00079 { 00080 impl_.join(); 00081 } 00082 00083 private: 00084 detail::thread impl_; 00085 }; 00086 00087 } // namespace asio 00088 00089 #include "asio/detail/pop_options.hpp" 00090 00091 #endif // ASIO_THREAD_HPP