blocking.hpp 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. //
  2. // execution/blocking.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2023 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 ASIO_EXECUTION_BLOCKING_HPP
  11. #define ASIO_EXECUTION_BLOCKING_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include "asio/detail/config.hpp"
  16. #include "asio/detail/type_traits.hpp"
  17. #include "asio/execution/executor.hpp"
  18. #include "asio/is_applicable_property.hpp"
  19. #include "asio/prefer.hpp"
  20. #include "asio/query.hpp"
  21. #include "asio/require.hpp"
  22. #include "asio/traits/execute_member.hpp"
  23. #include "asio/traits/query_free.hpp"
  24. #include "asio/traits/query_member.hpp"
  25. #include "asio/traits/query_static_constexpr_member.hpp"
  26. #include "asio/traits/static_query.hpp"
  27. #include "asio/traits/static_require.hpp"
  28. #include "asio/detail/push_options.hpp"
  29. namespace asio {
  30. #if defined(GENERATING_DOCUMENTATION)
  31. namespace execution {
  32. /// A property to describe what guarantees an executor makes about the blocking
  33. /// behaviour of their execution functions.
  34. struct blocking_t
  35. {
  36. /// The blocking_t property applies to executors.
  37. template <typename T>
  38. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  39. /// The top-level blocking_t property cannot be required.
  40. static constexpr bool is_requirable = false;
  41. /// The top-level blocking_t property cannot be preferred.
  42. static constexpr bool is_preferable = false;
  43. /// The type returned by queries against an @c any_executor.
  44. typedef blocking_t polymorphic_query_result_type;
  45. /// A sub-property that indicates that invocation of an executor's execution
  46. /// function may block pending completion of one or more invocations of the
  47. /// submitted function object.
  48. struct possibly_t
  49. {
  50. /// The blocking_t::possibly_t property applies to executors.
  51. template <typename T>
  52. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  53. /// The blocking_t::possibly_t property can be required.
  54. static constexpr bool is_requirable = true;
  55. /// The blocking_t::possibly_t property can be preferred.
  56. static constexpr bool is_preferable = true;
  57. /// The type returned by queries against an @c any_executor.
  58. typedef blocking_t polymorphic_query_result_type;
  59. /// Default constructor.
  60. constexpr possibly_t();
  61. /// Get the value associated with a property object.
  62. /**
  63. * @returns possibly_t();
  64. */
  65. static constexpr blocking_t value();
  66. };
  67. /// A sub-property that indicates that invocation of an executor's execution
  68. /// function shall block until completion of all invocations of the submitted
  69. /// function object.
  70. struct always_t
  71. {
  72. /// The blocking_t::always_t property applies to executors.
  73. template <typename T>
  74. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  75. /// The blocking_t::always_t property can be required.
  76. static constexpr bool is_requirable = true;
  77. /// The blocking_t::always_t property can be preferred.
  78. static constexpr bool is_preferable = false;
  79. /// The type returned by queries against an @c any_executor.
  80. typedef blocking_t polymorphic_query_result_type;
  81. /// Default constructor.
  82. constexpr always_t();
  83. /// Get the value associated with a property object.
  84. /**
  85. * @returns always_t();
  86. */
  87. static constexpr blocking_t value();
  88. };
  89. /// A sub-property that indicates that invocation of an executor's execution
  90. /// function shall not block pending completion of the invocations of the
  91. /// submitted function object.
  92. struct never_t
  93. {
  94. /// The blocking_t::never_t property applies to executors.
  95. template <typename T>
  96. static constexpr bool is_applicable_property_v = is_executor_v<T>;
  97. /// The blocking_t::never_t property can be required.
  98. static constexpr bool is_requirable = true;
  99. /// The blocking_t::never_t property can be preferred.
  100. static constexpr bool is_preferable = true;
  101. /// The type returned by queries against an @c any_executor.
  102. typedef blocking_t polymorphic_query_result_type;
  103. /// Default constructor.
  104. constexpr never_t();
  105. /// Get the value associated with a property object.
  106. /**
  107. * @returns never_t();
  108. */
  109. static constexpr blocking_t value();
  110. };
  111. /// A special value used for accessing the blocking_t::possibly_t property.
  112. static constexpr possibly_t possibly;
  113. /// A special value used for accessing the blocking_t::always_t property.
  114. static constexpr always_t always;
  115. /// A special value used for accessing the blocking_t::never_t property.
  116. static constexpr never_t never;
  117. /// Default constructor.
  118. constexpr blocking_t();
  119. /// Construct from a sub-property value.
  120. constexpr blocking_t(possibly_t);
  121. /// Construct from a sub-property value.
  122. constexpr blocking_t(always_t);
  123. /// Construct from a sub-property value.
  124. constexpr blocking_t(never_t);
  125. /// Compare property values for equality.
  126. friend constexpr bool operator==(
  127. const blocking_t& a, const blocking_t& b) noexcept;
  128. /// Compare property values for inequality.
  129. friend constexpr bool operator!=(
  130. const blocking_t& a, const blocking_t& b) noexcept;
  131. };
  132. /// A special value used for accessing the blocking_t property.
  133. constexpr blocking_t blocking;
  134. } // namespace execution
  135. #else // defined(GENERATING_DOCUMENTATION)
  136. namespace execution {
  137. namespace detail {
  138. namespace blocking {
  139. template <int I> struct possibly_t;
  140. template <int I> struct always_t;
  141. template <int I> struct never_t;
  142. } // namespace blocking
  143. namespace blocking_adaptation {
  144. template <int I> struct allowed_t;
  145. template <typename Executor, typename Function>
  146. void blocking_execute(
  147. Executor&& ex,
  148. Function&& func);
  149. } // namespace blocking_adaptation
  150. template <int I = 0>
  151. struct blocking_t
  152. {
  153. #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
  154. template <typename T>
  155. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  156. #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
  157. static constexpr bool is_requirable = false;
  158. static constexpr bool is_preferable = false;
  159. typedef blocking_t polymorphic_query_result_type;
  160. typedef detail::blocking::possibly_t<I> possibly_t;
  161. typedef detail::blocking::always_t<I> always_t;
  162. typedef detail::blocking::never_t<I> never_t;
  163. constexpr blocking_t()
  164. : value_(-1)
  165. {
  166. }
  167. constexpr blocking_t(possibly_t)
  168. : value_(0)
  169. {
  170. }
  171. constexpr blocking_t(always_t)
  172. : value_(1)
  173. {
  174. }
  175. constexpr blocking_t(never_t)
  176. : value_(2)
  177. {
  178. }
  179. template <typename T>
  180. struct proxy
  181. {
  182. #if defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  183. struct type
  184. {
  185. template <typename P>
  186. auto query(P&& p) const
  187. noexcept(
  188. noexcept(
  189. declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
  190. )
  191. )
  192. -> decltype(
  193. declval<conditional_t<true, T, P>>().query(static_cast<P&&>(p))
  194. );
  195. };
  196. #else // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  197. typedef T type;
  198. #endif // defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  199. };
  200. template <typename T>
  201. struct static_proxy
  202. {
  203. #if defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  204. struct type
  205. {
  206. template <typename P>
  207. static constexpr auto query(P&& p)
  208. noexcept(
  209. noexcept(
  210. conditional_t<true, T, P>::query(static_cast<P&&>(p))
  211. )
  212. )
  213. -> decltype(
  214. conditional_t<true, T, P>::query(static_cast<P&&>(p))
  215. )
  216. {
  217. return T::query(static_cast<P&&>(p));
  218. }
  219. };
  220. #else // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  221. typedef T type;
  222. #endif // defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  223. };
  224. template <typename T>
  225. struct query_member :
  226. traits::query_member<typename proxy<T>::type, blocking_t> {};
  227. template <typename T>
  228. struct query_static_constexpr_member :
  229. traits::query_static_constexpr_member<
  230. typename static_proxy<T>::type, blocking_t> {};
  231. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  232. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  233. template <typename T>
  234. static constexpr
  235. typename query_static_constexpr_member<T>::result_type
  236. static_query()
  237. noexcept(query_static_constexpr_member<T>::is_noexcept)
  238. {
  239. return query_static_constexpr_member<T>::value();
  240. }
  241. template <typename T>
  242. static constexpr
  243. typename traits::static_query<T, possibly_t>::result_type
  244. static_query(
  245. enable_if_t<
  246. !query_static_constexpr_member<T>::is_valid
  247. >* = 0,
  248. enable_if_t<
  249. !query_member<T>::is_valid
  250. >* = 0,
  251. enable_if_t<
  252. traits::static_query<T, possibly_t>::is_valid
  253. >* = 0) noexcept
  254. {
  255. return traits::static_query<T, possibly_t>::value();
  256. }
  257. template <typename T>
  258. static constexpr
  259. typename traits::static_query<T, always_t>::result_type
  260. static_query(
  261. enable_if_t<
  262. !query_static_constexpr_member<T>::is_valid
  263. >* = 0,
  264. enable_if_t<
  265. !query_member<T>::is_valid
  266. >* = 0,
  267. enable_if_t<
  268. !traits::static_query<T, possibly_t>::is_valid
  269. >* = 0,
  270. enable_if_t<
  271. traits::static_query<T, always_t>::is_valid
  272. >* = 0) noexcept
  273. {
  274. return traits::static_query<T, always_t>::value();
  275. }
  276. template <typename T>
  277. static constexpr
  278. typename traits::static_query<T, never_t>::result_type
  279. static_query(
  280. enable_if_t<
  281. !query_static_constexpr_member<T>::is_valid
  282. >* = 0,
  283. enable_if_t<
  284. !query_member<T>::is_valid
  285. >* = 0,
  286. enable_if_t<
  287. !traits::static_query<T, possibly_t>::is_valid
  288. >* = 0,
  289. enable_if_t<
  290. !traits::static_query<T, always_t>::is_valid
  291. >* = 0,
  292. enable_if_t<
  293. traits::static_query<T, never_t>::is_valid
  294. >* = 0) noexcept
  295. {
  296. return traits::static_query<T, never_t>::value();
  297. }
  298. template <typename E, typename T = decltype(blocking_t::static_query<E>())>
  299. static constexpr const T static_query_v
  300. = blocking_t::static_query<E>();
  301. #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  302. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  303. friend constexpr bool operator==(
  304. const blocking_t& a, const blocking_t& b)
  305. {
  306. return a.value_ == b.value_;
  307. }
  308. friend constexpr bool operator!=(
  309. const blocking_t& a, const blocking_t& b)
  310. {
  311. return a.value_ != b.value_;
  312. }
  313. struct convertible_from_blocking_t
  314. {
  315. constexpr convertible_from_blocking_t(blocking_t) {}
  316. };
  317. template <typename Executor>
  318. friend constexpr blocking_t query(
  319. const Executor& ex, convertible_from_blocking_t,
  320. enable_if_t<
  321. can_query<const Executor&, possibly_t>::value
  322. >* = 0)
  323. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  324. #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
  325. noexcept(is_nothrow_query<const Executor&, blocking_t<>::possibly_t>::value)
  326. #else // defined(ASIO_MSVC)
  327. noexcept(is_nothrow_query<const Executor&, possibly_t>::value)
  328. #endif // defined(ASIO_MSVC)
  329. #endif // !defined(__clang__)
  330. {
  331. return asio::query(ex, possibly_t());
  332. }
  333. template <typename Executor>
  334. friend constexpr blocking_t query(
  335. const Executor& ex, convertible_from_blocking_t,
  336. enable_if_t<
  337. !can_query<const Executor&, possibly_t>::value
  338. >* = 0,
  339. enable_if_t<
  340. can_query<const Executor&, always_t>::value
  341. >* = 0)
  342. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  343. #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
  344. noexcept(is_nothrow_query<const Executor&, blocking_t<>::always_t>::value)
  345. #else // defined(ASIO_MSVC)
  346. noexcept(is_nothrow_query<const Executor&, always_t>::value)
  347. #endif // defined(ASIO_MSVC)
  348. #endif // !defined(__clang__)
  349. {
  350. return asio::query(ex, always_t());
  351. }
  352. template <typename Executor>
  353. friend constexpr blocking_t query(
  354. const Executor& ex, convertible_from_blocking_t,
  355. enable_if_t<
  356. !can_query<const Executor&, possibly_t>::value
  357. >* = 0,
  358. enable_if_t<
  359. !can_query<const Executor&, always_t>::value
  360. >* = 0,
  361. enable_if_t<
  362. can_query<const Executor&, never_t>::value
  363. >* = 0)
  364. #if !defined(__clang__) // Clang crashes if noexcept is used here.
  365. #if defined(ASIO_MSVC) // Visual C++ wants the type to be qualified.
  366. noexcept(is_nothrow_query<const Executor&, blocking_t<>::never_t>::value)
  367. #else // defined(ASIO_MSVC)
  368. noexcept(is_nothrow_query<const Executor&, never_t>::value)
  369. #endif // defined(ASIO_MSVC)
  370. #endif // !defined(__clang__)
  371. {
  372. return asio::query(ex, never_t());
  373. }
  374. ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(possibly_t, possibly);
  375. ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(always_t, always);
  376. ASIO_STATIC_CONSTEXPR_DEFAULT_INIT(never_t, never);
  377. private:
  378. int value_;
  379. };
  380. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  381. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  382. template <int I> template <typename E, typename T>
  383. const T blocking_t<I>::static_query_v;
  384. #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  385. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  386. template <int I>
  387. const typename blocking_t<I>::possibly_t blocking_t<I>::possibly;
  388. template <int I>
  389. const typename blocking_t<I>::always_t blocking_t<I>::always;
  390. template <int I>
  391. const typename blocking_t<I>::never_t blocking_t<I>::never;
  392. namespace blocking {
  393. template <int I = 0>
  394. struct possibly_t
  395. {
  396. #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
  397. template <typename T>
  398. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  399. #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
  400. static constexpr bool is_requirable = true;
  401. static constexpr bool is_preferable = true;
  402. typedef blocking_t<I> polymorphic_query_result_type;
  403. constexpr possibly_t()
  404. {
  405. }
  406. template <typename T>
  407. struct query_member :
  408. traits::query_member<
  409. typename blocking_t<I>::template proxy<T>::type, possibly_t> {};
  410. template <typename T>
  411. struct query_static_constexpr_member :
  412. traits::query_static_constexpr_member<
  413. typename blocking_t<I>::template static_proxy<T>::type, possibly_t> {};
  414. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  415. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  416. template <typename T>
  417. static constexpr
  418. typename query_static_constexpr_member<T>::result_type
  419. static_query()
  420. noexcept(query_static_constexpr_member<T>::is_noexcept)
  421. {
  422. return query_static_constexpr_member<T>::value();
  423. }
  424. template <typename T>
  425. static constexpr possibly_t static_query(
  426. enable_if_t<
  427. !query_static_constexpr_member<T>::is_valid
  428. >* = 0,
  429. enable_if_t<
  430. !query_member<T>::is_valid
  431. >* = 0,
  432. enable_if_t<
  433. !traits::query_free<T, possibly_t>::is_valid
  434. >* = 0,
  435. enable_if_t<
  436. !can_query<T, always_t<I>>::value
  437. >* = 0,
  438. enable_if_t<
  439. !can_query<T, never_t<I>>::value
  440. >* = 0) noexcept
  441. {
  442. return possibly_t();
  443. }
  444. template <typename E, typename T = decltype(possibly_t::static_query<E>())>
  445. static constexpr const T static_query_v
  446. = possibly_t::static_query<E>();
  447. #endif // defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  448. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  449. static constexpr blocking_t<I> value()
  450. {
  451. return possibly_t();
  452. }
  453. friend constexpr bool operator==(
  454. const possibly_t&, const possibly_t&)
  455. {
  456. return true;
  457. }
  458. friend constexpr bool operator!=(
  459. const possibly_t&, const possibly_t&)
  460. {
  461. return false;
  462. }
  463. friend constexpr bool operator==(
  464. const possibly_t&, const always_t<I>&)
  465. {
  466. return false;
  467. }
  468. friend constexpr bool operator!=(
  469. const possibly_t&, const always_t<I>&)
  470. {
  471. return true;
  472. }
  473. friend constexpr bool operator==(
  474. const possibly_t&, const never_t<I>&)
  475. {
  476. return false;
  477. }
  478. friend constexpr bool operator!=(
  479. const possibly_t&, const never_t<I>&)
  480. {
  481. return true;
  482. }
  483. };
  484. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  485. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  486. template <int I> template <typename E, typename T>
  487. const T possibly_t<I>::static_query_v;
  488. #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  489. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  490. template <typename Executor>
  491. class adapter
  492. {
  493. public:
  494. adapter(int, const Executor& e) noexcept
  495. : executor_(e)
  496. {
  497. }
  498. adapter(const adapter& other) noexcept
  499. : executor_(other.executor_)
  500. {
  501. }
  502. adapter(adapter&& other) noexcept
  503. : executor_(static_cast<Executor&&>(other.executor_))
  504. {
  505. }
  506. template <int I>
  507. static constexpr always_t<I> query(blocking_t<I>) noexcept
  508. {
  509. return always_t<I>();
  510. }
  511. template <int I>
  512. static constexpr always_t<I> query(possibly_t<I>) noexcept
  513. {
  514. return always_t<I>();
  515. }
  516. template <int I>
  517. static constexpr always_t<I> query(always_t<I>) noexcept
  518. {
  519. return always_t<I>();
  520. }
  521. template <int I>
  522. static constexpr always_t<I> query(never_t<I>) noexcept
  523. {
  524. return always_t<I>();
  525. }
  526. template <typename Property>
  527. enable_if_t<
  528. can_query<const Executor&, Property>::value,
  529. query_result_t<const Executor&, Property>
  530. > query(const Property& p) const
  531. noexcept(is_nothrow_query<const Executor&, Property>::value)
  532. {
  533. return asio::query(executor_, p);
  534. }
  535. template <int I>
  536. enable_if_t<
  537. can_require<const Executor&, possibly_t<I>>::value,
  538. require_result_t<const Executor&, possibly_t<I>>
  539. > require(possibly_t<I>) const noexcept
  540. {
  541. return asio::require(executor_, possibly_t<I>());
  542. }
  543. template <int I>
  544. enable_if_t<
  545. can_require<const Executor&, never_t<I>>::value,
  546. require_result_t<const Executor&, never_t<I>>
  547. > require(never_t<I>) const noexcept
  548. {
  549. return asio::require(executor_, never_t<I>());
  550. }
  551. template <typename Property>
  552. enable_if_t<
  553. can_require<const Executor&, Property>::value,
  554. adapter<decay_t<require_result_t<const Executor&, Property>>>
  555. > require(const Property& p) const
  556. noexcept(is_nothrow_require<const Executor&, Property>::value)
  557. {
  558. return adapter<decay_t<require_result_t<const Executor&, Property>>>(
  559. 0, asio::require(executor_, p));
  560. }
  561. template <typename Property>
  562. enable_if_t<
  563. can_prefer<const Executor&, Property>::value,
  564. adapter<decay_t<prefer_result_t<const Executor&, Property>>>
  565. > prefer(const Property& p) const
  566. noexcept(is_nothrow_prefer<const Executor&, Property>::value)
  567. {
  568. return adapter<decay_t<prefer_result_t<const Executor&, Property>>>(
  569. 0, asio::prefer(executor_, p));
  570. }
  571. template <typename Function>
  572. enable_if_t<
  573. traits::execute_member<const Executor&, Function>::is_valid
  574. > execute(Function&& f) const
  575. {
  576. blocking_adaptation::blocking_execute(
  577. executor_, static_cast<Function&&>(f));
  578. }
  579. friend bool operator==(const adapter& a, const adapter& b) noexcept
  580. {
  581. return a.executor_ == b.executor_;
  582. }
  583. friend bool operator!=(const adapter& a, const adapter& b) noexcept
  584. {
  585. return a.executor_ != b.executor_;
  586. }
  587. private:
  588. Executor executor_;
  589. };
  590. template <int I = 0>
  591. struct always_t
  592. {
  593. #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
  594. template <typename T>
  595. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  596. #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
  597. static constexpr bool is_requirable = true;
  598. static constexpr bool is_preferable = false;
  599. typedef blocking_t<I> polymorphic_query_result_type;
  600. constexpr always_t()
  601. {
  602. }
  603. template <typename T>
  604. struct query_member :
  605. traits::query_member<
  606. typename blocking_t<I>::template proxy<T>::type, always_t> {};
  607. template <typename T>
  608. struct query_static_constexpr_member :
  609. traits::query_static_constexpr_member<
  610. typename blocking_t<I>::template static_proxy<T>::type, always_t> {};
  611. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  612. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  613. template <typename T>
  614. static constexpr typename query_static_constexpr_member<T>::result_type
  615. static_query()
  616. noexcept(query_static_constexpr_member<T>::is_noexcept)
  617. {
  618. return query_static_constexpr_member<T>::value();
  619. }
  620. template <typename E, typename T = decltype(always_t::static_query<E>())>
  621. static constexpr const T static_query_v = always_t::static_query<E>();
  622. #endif // defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  623. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  624. static constexpr blocking_t<I> value()
  625. {
  626. return always_t();
  627. }
  628. friend constexpr bool operator==(
  629. const always_t&, const always_t&)
  630. {
  631. return true;
  632. }
  633. friend constexpr bool operator!=(
  634. const always_t&, const always_t&)
  635. {
  636. return false;
  637. }
  638. friend constexpr bool operator==(
  639. const always_t&, const possibly_t<I>&)
  640. {
  641. return false;
  642. }
  643. friend constexpr bool operator!=(
  644. const always_t&, const possibly_t<I>&)
  645. {
  646. return true;
  647. }
  648. friend constexpr bool operator==(
  649. const always_t&, const never_t<I>&)
  650. {
  651. return false;
  652. }
  653. friend constexpr bool operator!=(
  654. const always_t&, const never_t<I>&)
  655. {
  656. return true;
  657. }
  658. template <typename Executor>
  659. friend adapter<Executor> require(
  660. const Executor& e, const always_t&,
  661. enable_if_t<
  662. is_executor<Executor>::value
  663. >* = 0,
  664. enable_if_t<
  665. traits::static_require<
  666. const Executor&,
  667. blocking_adaptation::allowed_t<0>
  668. >::is_valid
  669. >* = 0)
  670. {
  671. return adapter<Executor>(0, e);
  672. }
  673. };
  674. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  675. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  676. template <int I> template <typename E, typename T>
  677. const T always_t<I>::static_query_v;
  678. #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  679. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  680. template <int I>
  681. struct never_t
  682. {
  683. #if defined(ASIO_HAS_VARIABLE_TEMPLATES)
  684. template <typename T>
  685. static constexpr bool is_applicable_property_v = is_executor<T>::value;
  686. #endif // defined(ASIO_HAS_VARIABLE_TEMPLATES)
  687. static constexpr bool is_requirable = true;
  688. static constexpr bool is_preferable = true;
  689. typedef blocking_t<I> polymorphic_query_result_type;
  690. constexpr never_t()
  691. {
  692. }
  693. template <typename T>
  694. struct query_member :
  695. traits::query_member<
  696. typename blocking_t<I>::template proxy<T>::type, never_t> {};
  697. template <typename T>
  698. struct query_static_constexpr_member :
  699. traits::query_static_constexpr_member<
  700. typename blocking_t<I>::template static_proxy<T>::type, never_t> {};
  701. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  702. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  703. template <typename T>
  704. static constexpr
  705. typename query_static_constexpr_member<T>::result_type
  706. static_query()
  707. noexcept(query_static_constexpr_member<T>::is_noexcept)
  708. {
  709. return query_static_constexpr_member<T>::value();
  710. }
  711. template <typename E, typename T = decltype(never_t::static_query<E>())>
  712. static constexpr const T static_query_v
  713. = never_t::static_query<E>();
  714. #endif // defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  715. // && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  716. static constexpr blocking_t<I> value()
  717. {
  718. return never_t();
  719. }
  720. friend constexpr bool operator==(const never_t&, const never_t&)
  721. {
  722. return true;
  723. }
  724. friend constexpr bool operator!=(const never_t&, const never_t&)
  725. {
  726. return false;
  727. }
  728. friend constexpr bool operator==(const never_t&, const possibly_t<I>&)
  729. {
  730. return false;
  731. }
  732. friend constexpr bool operator!=(const never_t&, const possibly_t<I>&)
  733. {
  734. return true;
  735. }
  736. friend constexpr bool operator==(const never_t&, const always_t<I>&)
  737. {
  738. return false;
  739. }
  740. friend constexpr bool operator!=(const never_t&, const always_t<I>&)
  741. {
  742. return true;
  743. }
  744. };
  745. #if defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  746. && defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  747. template <int I> template <typename E, typename T>
  748. const T never_t<I>::static_query_v;
  749. #endif // defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  750. } // namespace blocking
  751. } // namespace detail
  752. typedef detail::blocking_t<> blocking_t;
  753. constexpr blocking_t blocking;
  754. } // namespace execution
  755. #if !defined(ASIO_HAS_VARIABLE_TEMPLATES)
  756. template <typename T>
  757. struct is_applicable_property<T, execution::blocking_t>
  758. : integral_constant<bool, execution::is_executor<T>::value>
  759. {
  760. };
  761. template <typename T>
  762. struct is_applicable_property<T, execution::blocking_t::possibly_t>
  763. : integral_constant<bool, execution::is_executor<T>::value>
  764. {
  765. };
  766. template <typename T>
  767. struct is_applicable_property<T, execution::blocking_t::always_t>
  768. : integral_constant<bool, execution::is_executor<T>::value>
  769. {
  770. };
  771. template <typename T>
  772. struct is_applicable_property<T, execution::blocking_t::never_t>
  773. : integral_constant<bool, execution::is_executor<T>::value>
  774. {
  775. };
  776. #endif // !defined(ASIO_HAS_VARIABLE_TEMPLATES)
  777. namespace traits {
  778. #if !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  779. template <typename T>
  780. struct query_free_default<T, execution::blocking_t,
  781. enable_if_t<
  782. can_query<T, execution::blocking_t::possibly_t>::value
  783. >>
  784. {
  785. static constexpr bool is_valid = true;
  786. static constexpr bool is_noexcept =
  787. is_nothrow_query<T, execution::blocking_t::possibly_t>::value;
  788. typedef execution::blocking_t result_type;
  789. };
  790. template <typename T>
  791. struct query_free_default<T, execution::blocking_t,
  792. enable_if_t<
  793. !can_query<T, execution::blocking_t::possibly_t>::value
  794. && can_query<T, execution::blocking_t::always_t>::value
  795. >>
  796. {
  797. static constexpr bool is_valid = true;
  798. static constexpr bool is_noexcept =
  799. is_nothrow_query<T, execution::blocking_t::always_t>::value;
  800. typedef execution::blocking_t result_type;
  801. };
  802. template <typename T>
  803. struct query_free_default<T, execution::blocking_t,
  804. enable_if_t<
  805. !can_query<T, execution::blocking_t::possibly_t>::value
  806. && !can_query<T, execution::blocking_t::always_t>::value
  807. && can_query<T, execution::blocking_t::never_t>::value
  808. >>
  809. {
  810. static constexpr bool is_valid = true;
  811. static constexpr bool is_noexcept =
  812. is_nothrow_query<T, execution::blocking_t::never_t>::value;
  813. typedef execution::blocking_t result_type;
  814. };
  815. #endif // !defined(ASIO_HAS_DEDUCED_QUERY_FREE_TRAIT)
  816. #if !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT) \
  817. || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  818. template <typename T>
  819. struct static_query<T, execution::blocking_t,
  820. enable_if_t<
  821. execution::detail::blocking_t<0>::
  822. query_static_constexpr_member<T>::is_valid
  823. >>
  824. {
  825. static constexpr bool is_valid = true;
  826. static constexpr bool is_noexcept = true;
  827. typedef typename execution::detail::blocking_t<0>::
  828. query_static_constexpr_member<T>::result_type result_type;
  829. static constexpr result_type value()
  830. {
  831. return execution::blocking_t::query_static_constexpr_member<T>::value();
  832. }
  833. };
  834. template <typename T>
  835. struct static_query<T, execution::blocking_t,
  836. enable_if_t<
  837. !execution::detail::blocking_t<0>::
  838. query_static_constexpr_member<T>::is_valid
  839. && !execution::detail::blocking_t<0>::
  840. query_member<T>::is_valid
  841. && traits::static_query<T, execution::blocking_t::possibly_t>::is_valid
  842. >>
  843. {
  844. static constexpr bool is_valid = true;
  845. static constexpr bool is_noexcept = true;
  846. typedef typename traits::static_query<T,
  847. execution::blocking_t::possibly_t>::result_type result_type;
  848. static constexpr result_type value()
  849. {
  850. return traits::static_query<T, execution::blocking_t::possibly_t>::value();
  851. }
  852. };
  853. template <typename T>
  854. struct static_query<T, execution::blocking_t,
  855. enable_if_t<
  856. !execution::detail::blocking_t<0>::
  857. query_static_constexpr_member<T>::is_valid
  858. && !execution::detail::blocking_t<0>::
  859. query_member<T>::is_valid
  860. && !traits::static_query<T, execution::blocking_t::possibly_t>::is_valid
  861. && traits::static_query<T, execution::blocking_t::always_t>::is_valid
  862. >>
  863. {
  864. static constexpr bool is_valid = true;
  865. static constexpr bool is_noexcept = true;
  866. typedef typename traits::static_query<T,
  867. execution::blocking_t::always_t>::result_type result_type;
  868. static constexpr result_type value()
  869. {
  870. return traits::static_query<T, execution::blocking_t::always_t>::value();
  871. }
  872. };
  873. template <typename T>
  874. struct static_query<T, execution::blocking_t,
  875. enable_if_t<
  876. !execution::detail::blocking_t<0>::
  877. query_static_constexpr_member<T>::is_valid
  878. && !execution::detail::blocking_t<0>::
  879. query_member<T>::is_valid
  880. && !traits::static_query<T, execution::blocking_t::possibly_t>::is_valid
  881. && !traits::static_query<T, execution::blocking_t::always_t>::is_valid
  882. && traits::static_query<T, execution::blocking_t::never_t>::is_valid
  883. >>
  884. {
  885. static constexpr bool is_valid = true;
  886. static constexpr bool is_noexcept = true;
  887. typedef typename traits::static_query<T,
  888. execution::blocking_t::never_t>::result_type result_type;
  889. static constexpr result_type value()
  890. {
  891. return traits::static_query<T, execution::blocking_t::never_t>::value();
  892. }
  893. };
  894. template <typename T>
  895. struct static_query<T, execution::blocking_t::possibly_t,
  896. enable_if_t<
  897. execution::detail::blocking::possibly_t<0>::
  898. query_static_constexpr_member<T>::is_valid
  899. >>
  900. {
  901. static constexpr bool is_valid = true;
  902. static constexpr bool is_noexcept = true;
  903. typedef typename execution::detail::blocking::possibly_t<0>::
  904. query_static_constexpr_member<T>::result_type result_type;
  905. static constexpr result_type value()
  906. {
  907. return execution::detail::blocking::possibly_t<0>::
  908. query_static_constexpr_member<T>::value();
  909. }
  910. };
  911. template <typename T>
  912. struct static_query<T, execution::blocking_t::possibly_t,
  913. enable_if_t<
  914. !execution::detail::blocking::possibly_t<0>::
  915. query_static_constexpr_member<T>::is_valid
  916. && !execution::detail::blocking::possibly_t<0>::
  917. query_member<T>::is_valid
  918. && !traits::query_free<T, execution::blocking_t::possibly_t>::is_valid
  919. && !can_query<T, execution::blocking_t::always_t>::value
  920. && !can_query<T, execution::blocking_t::never_t>::value
  921. >>
  922. {
  923. static constexpr bool is_valid = true;
  924. static constexpr bool is_noexcept = true;
  925. typedef execution::blocking_t::possibly_t result_type;
  926. static constexpr result_type value()
  927. {
  928. return result_type();
  929. }
  930. };
  931. template <typename T>
  932. struct static_query<T, execution::blocking_t::always_t,
  933. enable_if_t<
  934. execution::detail::blocking::always_t<0>::
  935. query_static_constexpr_member<T>::is_valid
  936. >>
  937. {
  938. static constexpr bool is_valid = true;
  939. static constexpr bool is_noexcept = true;
  940. typedef typename execution::detail::blocking::always_t<0>::
  941. query_static_constexpr_member<T>::result_type result_type;
  942. static constexpr result_type value()
  943. {
  944. return execution::detail::blocking::always_t<0>::
  945. query_static_constexpr_member<T>::value();
  946. }
  947. };
  948. template <typename T>
  949. struct static_query<T, execution::blocking_t::never_t,
  950. enable_if_t<
  951. execution::detail::blocking::never_t<0>::
  952. query_static_constexpr_member<T>::is_valid
  953. >>
  954. {
  955. static constexpr bool is_valid = true;
  956. static constexpr bool is_noexcept = true;
  957. typedef typename execution::detail::blocking::never_t<0>::
  958. query_static_constexpr_member<T>::result_type result_type;
  959. static constexpr result_type value()
  960. {
  961. return execution::detail::blocking::never_t<0>::
  962. query_static_constexpr_member<T>::value();
  963. }
  964. };
  965. #endif // !defined(ASIO_HAS_DEDUCED_STATIC_QUERY_TRAIT)
  966. // || !defined(ASIO_HAS_SFINAE_VARIABLE_TEMPLATES)
  967. #if !defined(ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT)
  968. template <typename T>
  969. struct require_free_default<T, execution::blocking_t::always_t,
  970. enable_if_t<
  971. is_same<T, decay_t<T>>::value
  972. && execution::is_executor<T>::value
  973. && traits::static_require<
  974. const T&,
  975. execution::detail::blocking_adaptation::allowed_t<0>
  976. >::is_valid
  977. >>
  978. {
  979. static constexpr bool is_valid = true;
  980. static constexpr bool is_noexcept = false;
  981. typedef execution::detail::blocking::adapter<T> result_type;
  982. };
  983. #endif // !defined(ASIO_HAS_DEDUCED_REQUIRE_FREE_TRAIT)
  984. #if !defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
  985. template <typename Executor>
  986. struct equality_comparable<
  987. execution::detail::blocking::adapter<Executor>>
  988. {
  989. static constexpr bool is_valid = true;
  990. static constexpr bool is_noexcept = true;
  991. };
  992. #endif // !defined(ASIO_HAS_DEDUCED_EQUALITY_COMPARABLE_TRAIT)
  993. #if !defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
  994. template <typename Executor, typename Function>
  995. struct execute_member<
  996. execution::detail::blocking::adapter<Executor>, Function>
  997. {
  998. static constexpr bool is_valid = true;
  999. static constexpr bool is_noexcept = false;
  1000. typedef void result_type;
  1001. };
  1002. #endif // !defined(ASIO_HAS_DEDUCED_EXECUTE_MEMBER_TRAIT)
  1003. #if !defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  1004. template <typename Executor, int I>
  1005. struct query_static_constexpr_member<
  1006. execution::detail::blocking::adapter<Executor>,
  1007. execution::detail::blocking_t<I>>
  1008. {
  1009. static constexpr bool is_valid = true;
  1010. static constexpr bool is_noexcept = true;
  1011. typedef execution::blocking_t::always_t result_type;
  1012. static constexpr result_type value() noexcept
  1013. {
  1014. return result_type();
  1015. }
  1016. };
  1017. template <typename Executor, int I>
  1018. struct query_static_constexpr_member<
  1019. execution::detail::blocking::adapter<Executor>,
  1020. execution::detail::blocking::always_t<I>>
  1021. {
  1022. static constexpr bool is_valid = true;
  1023. static constexpr bool is_noexcept = true;
  1024. typedef execution::blocking_t::always_t result_type;
  1025. static constexpr result_type value() noexcept
  1026. {
  1027. return result_type();
  1028. }
  1029. };
  1030. template <typename Executor, int I>
  1031. struct query_static_constexpr_member<
  1032. execution::detail::blocking::adapter<Executor>,
  1033. execution::detail::blocking::possibly_t<I>>
  1034. {
  1035. static constexpr bool is_valid = true;
  1036. static constexpr bool is_noexcept = true;
  1037. typedef execution::blocking_t::always_t result_type;
  1038. static constexpr result_type value() noexcept
  1039. {
  1040. return result_type();
  1041. }
  1042. };
  1043. template <typename Executor, int I>
  1044. struct query_static_constexpr_member<
  1045. execution::detail::blocking::adapter<Executor>,
  1046. execution::detail::blocking::never_t<I>>
  1047. {
  1048. static constexpr bool is_valid = true;
  1049. static constexpr bool is_noexcept = true;
  1050. typedef execution::blocking_t::always_t result_type;
  1051. static constexpr result_type value() noexcept
  1052. {
  1053. return result_type();
  1054. }
  1055. };
  1056. #endif // !defined(ASIO_HAS_DEDUCED_QUERY_STATIC_CONSTEXPR_MEMBER_TRAIT)
  1057. #if !defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  1058. template <typename Executor, typename Property>
  1059. struct query_member<
  1060. execution::detail::blocking::adapter<Executor>, Property,
  1061. enable_if_t<
  1062. can_query<const Executor&, Property>::value
  1063. >>
  1064. {
  1065. static constexpr bool is_valid = true;
  1066. static constexpr bool is_noexcept =
  1067. is_nothrow_query<Executor, Property>::value;
  1068. typedef query_result_t<Executor, Property> result_type;
  1069. };
  1070. #endif // !defined(ASIO_HAS_DEDUCED_QUERY_MEMBER_TRAIT)
  1071. #if !defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
  1072. template <typename Executor, int I>
  1073. struct require_member<
  1074. execution::detail::blocking::adapter<Executor>,
  1075. execution::detail::blocking::possibly_t<I>,
  1076. enable_if_t<
  1077. can_require<
  1078. const Executor&,
  1079. execution::detail::blocking::possibly_t<I>
  1080. >::value
  1081. >>
  1082. {
  1083. static constexpr bool is_valid = true;
  1084. static constexpr bool is_noexcept =
  1085. is_nothrow_require<const Executor&,
  1086. execution::detail::blocking::possibly_t<I>>::value;
  1087. typedef require_result_t<const Executor&,
  1088. execution::detail::blocking::possibly_t<I>> result_type;
  1089. };
  1090. template <typename Executor, int I>
  1091. struct require_member<
  1092. execution::detail::blocking::adapter<Executor>,
  1093. execution::detail::blocking::never_t<I>,
  1094. enable_if_t<
  1095. can_require<
  1096. const Executor&,
  1097. execution::detail::blocking::never_t<I>
  1098. >::value
  1099. >>
  1100. {
  1101. static constexpr bool is_valid = true;
  1102. static constexpr bool is_noexcept =
  1103. is_nothrow_require<const Executor&,
  1104. execution::detail::blocking::never_t<I>>::value;
  1105. typedef require_result_t<const Executor&,
  1106. execution::detail::blocking::never_t<I>> result_type;
  1107. };
  1108. template <typename Executor, typename Property>
  1109. struct require_member<
  1110. execution::detail::blocking::adapter<Executor>, Property,
  1111. enable_if_t<
  1112. can_require<const Executor&, Property>::value
  1113. >>
  1114. {
  1115. static constexpr bool is_valid = true;
  1116. static constexpr bool is_noexcept =
  1117. is_nothrow_require<Executor, Property>::value;
  1118. typedef execution::detail::blocking::adapter<
  1119. decay_t<require_result_t<Executor, Property>>> result_type;
  1120. };
  1121. #endif // !defined(ASIO_HAS_DEDUCED_REQUIRE_MEMBER_TRAIT)
  1122. #if !defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
  1123. template <typename Executor, typename Property>
  1124. struct prefer_member<
  1125. execution::detail::blocking::adapter<Executor>, Property,
  1126. enable_if_t<
  1127. can_prefer<const Executor&, Property>::value
  1128. >>
  1129. {
  1130. static constexpr bool is_valid = true;
  1131. static constexpr bool is_noexcept =
  1132. is_nothrow_prefer<Executor, Property>::value;
  1133. typedef execution::detail::blocking::adapter<
  1134. decay_t<prefer_result_t<Executor, Property>>> result_type;
  1135. };
  1136. #endif // !defined(ASIO_HAS_DEDUCED_PREFER_MEMBER_TRAIT)
  1137. } // namespace traits
  1138. #endif // defined(GENERATING_DOCUMENTATION)
  1139. } // namespace asio
  1140. #include "asio/detail/pop_options.hpp"
  1141. #endif // ASIO_EXECUTION_BLOCKING_HPP