detached.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //
  2. // detached.hpp
  3. // ~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_DETACHED_HPP
  11. #define BOOST_ASIO_DETACHED_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #include <memory>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. /// Class used to specify that an asynchronous operation is detached.
  21. /**
  22. * The detached_t class is used to indicate that an asynchronous operation is
  23. * detached. That is, there is no completion handler waiting for the
  24. * operation's result. A detached_t object may be passed as a handler to an
  25. * asynchronous operation, typically using the special value
  26. * @c boost::asio::detached. For example:
  27. * @code my_socket.async_send(my_buffer, boost::asio::detached);
  28. * @endcode
  29. */
  30. class detached_t
  31. {
  32. public:
  33. /// Constructor.
  34. BOOST_ASIO_CONSTEXPR detached_t()
  35. {
  36. }
  37. };
  38. /// A special value, similar to std::nothrow.
  39. /**
  40. * See the documentation for boost::asio::detached_t for a usage example.
  41. */
  42. #if defined(BOOST_ASIO_HAS_CONSTEXPR) || defined(GENERATING_DOCUMENTATION)
  43. constexpr detached_t detached;
  44. #elif defined(BOOST_ASIO_MSVC)
  45. __declspec(selectany) detached_t detached;
  46. #endif
  47. } // namespace asio
  48. } // namespace boost
  49. #include <boost/asio/detail/pop_options.hpp>
  50. #include <boost/asio/impl/detached.hpp>
  51. #endif // BOOST_ASIO_DETACHED_HPP