00001 // 00002 // null_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_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 // The purpose of the thread. 00042 enum purpose { internal, external }; 00043 00044 // Constructor. 00045 template <typename Function> 00046 null_thread(Function f, purpose = internal) 00047 { 00048 asio::system_error e( 00049 asio::error::operation_not_supported, "thread"); 00050 boost::throw_exception(e); 00051 } 00052 00053 // Destructor. 00054 ~null_thread() 00055 { 00056 } 00057 00058 // Wait for the thread to exit. 00059 void join() 00060 { 00061 } 00062 }; 00063 00064 } // namespace detail 00065 } // namespace asio 00066 00067 #endif // !defined(BOOST_HAS_THREADS) 00068 00069 #include "asio/detail/pop_options.hpp" 00070 00071 #endif // ASIO_DETAIL_NULL_THREAD_HPP