00001 // 00002 // null_thread.hpp 00003 // ~~~~~~~~~~~~~~~ 00004 // 00005 // Copyright (c) 2003-2007 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_DETAIL_NULL_THREAD_HPP 00012 #define ASIO_DETAIL_NULL_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/push_options.hpp" 00021 #include <boost/config.hpp> 00022 #include "asio/detail/pop_options.hpp" 00023 00024 #if !defined(BOOST_HAS_THREADS) 00025 00026 #include "asio/detail/push_options.hpp" 00027 #include <boost/throw_exception.hpp> 00028 #include "asio/detail/pop_options.hpp" 00029 00030 #include "asio/error.hpp" 00031 #include "asio/system_error.hpp" 00032 #include "asio/detail/noncopyable.hpp" 00033 00034 namespace asio { 00035 namespace detail { 00036 00037 class null_thread 00038 : private noncopyable 00039 { 00040 public: 00041 // Constructor. 00042 template <typename Function> 00043 null_thread(Function f) 00044 { 00045 asio::system_error e( 00046 asio::error::operation_not_supported, "thread"); 00047 boost::throw_exception(e); 00048 } 00049 00050 // Destructor. 00051 ~null_thread() 00052 { 00053 } 00054 00055 // Wait for the thread to exit. 00056 void join() 00057 { 00058 } 00059 }; 00060 00061 } // namespace detail 00062 } // namespace asio 00063 00064 #endif // !defined(BOOST_HAS_THREADS) 00065 00066 #include "asio/detail/pop_options.hpp" 00067 00068 #endif // ASIO_DETAIL_NULL_THREAD_HPP
1.5.6