00001 // Internal version: Please do not publish! 00002 // (... until released under FreeBSD-like license *g*) 00003 // Code: Sebastian Mies <mies@tm.uka.de> 00004 00005 #ifndef ASIO_IO_SERVICE_H_ 00006 #define ASIO_IO_SERVICE_H_ 00007 00008 #include<boost/thread.hpp> 00009 #include<boost/asio.hpp> 00010 00011 namespace ariba { 00012 namespace transport { 00013 namespace detail { 00014 00020 class asio_io_service { 00021 private: 00022 int references; 00023 volatile bool running; 00024 volatile bool destroy; 00025 boost::thread* thread; 00026 boost::asio::io_service* service; 00027 00028 static asio_io_service* singleton; 00029 00030 friend class boost::thread; 00031 friend class boost::detail::thread_data<boost::reference_wrapper<asio_io_service> >; 00032 00033 protected: 00034 void operator ()(); 00035 asio_io_service(); 00036 ~asio_io_service(); 00037 void internal_start(); 00038 void internal_stop(); 00039 public: 00040 static boost::asio::io_service& alloc(); 00041 static void free(); 00042 static void start(); 00043 static void stop(); 00044 }; 00045 00046 }}} // namespace ariba::transport::detail 00047 00048 #endif /* ASIO_IO_SERVICE_H_ */