123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- #ifndef BOOST_ASIO_STRAND_HPP
- #define BOOST_ASIO_STRAND_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1200)
- # pragma once
- #endif
- #include <boost/asio/detail/push_options.hpp>
- #include <boost/asio/io_service.hpp>
- #include <boost/asio/detail/strand_service.hpp>
- #include <boost/asio/detail/wrapped_handler.hpp>
- namespace boost {
- namespace asio {
- class io_service::strand
- {
- public:
-
-
- explicit strand(boost::asio::io_service& io_service)
- : service_(boost::asio::use_service<
- boost::asio::detail::strand_service>(io_service))
- {
- service_.construct(impl_);
- }
-
-
- ~strand()
- {
- service_.destroy(impl_);
- }
-
-
-
- boost::asio::io_service& io_service()
- {
- return service_.get_io_service();
- }
-
-
- boost::asio::io_service& get_io_service()
- {
- return service_.get_io_service();
- }
-
-
- template <typename Handler>
- void dispatch(Handler handler)
- {
- service_.dispatch(impl_, handler);
- }
-
-
-
- template <typename Handler>
- void post(Handler handler)
- {
- service_.post(impl_, handler);
- }
-
-
-
- template <typename Handler>
- #if defined(GENERATING_DOCUMENTATION)
- unspecified
- #else
- detail::wrapped_handler<strand, Handler>
- #endif
- wrap(Handler handler)
- {
- return detail::wrapped_handler<io_service::strand, Handler>(*this, handler);
- }
- private:
- boost::asio::detail::strand_service& service_;
- boost::asio::detail::strand_service::implementation_type impl_;
- };
- typedef boost::asio::io_service::strand strand;
- }
- }
- #include <boost/asio/detail/pop_options.hpp>
- #endif
|