passenger 6.0.16 → 6.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (290) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +46 -2
  3. data/CONTRIBUTORS +2 -0
  4. data/build/integration_tests.rb +6 -6
  5. data/build/ruby_tests.rb +1 -1
  6. data/build/test_basics.rb +0 -1
  7. data/src/agent/Core/Config.h +1 -1
  8. data/src/agent/Core/Controller/Config.h +1 -1
  9. data/src/agent/Core/SpawningKit/PipeWatcher.h +18 -3
  10. data/src/agent/Watchdog/Config.h +1 -1
  11. data/src/cxx_supportlib/Constants.h +1 -1
  12. data/src/cxx_supportlib/vendor-modified/boost/align/aligned_alloc.hpp +1 -1
  13. data/src/cxx_supportlib/vendor-modified/boost/array.hpp +1 -1
  14. data/src/cxx_supportlib/vendor-modified/boost/asio/any_completion_executor.hpp +344 -0
  15. data/src/cxx_supportlib/vendor-modified/boost/asio/any_completion_handler.hpp +686 -0
  16. data/src/cxx_supportlib/vendor-modified/boost/asio/any_io_executor.hpp +56 -0
  17. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_allocator.hpp +81 -25
  18. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_cancellation_slot.hpp +68 -8
  19. data/src/cxx_supportlib/vendor-modified/boost/asio/associated_executor.hpp +46 -11
  20. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_datagram_socket.hpp +4 -4
  21. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_deadline_timer.hpp +2 -2
  22. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_file.hpp +1 -1
  23. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_random_access_file.hpp +2 -2
  24. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_raw_socket.hpp +4 -4
  25. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_readable_pipe.hpp +2 -2
  26. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_seq_packet_socket.hpp +2 -2
  27. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_serial_port.hpp +3 -3
  28. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_signal_set.hpp +2 -2
  29. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket.hpp +3 -3
  30. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_socket_acceptor.hpp +4 -4
  31. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_file.hpp +2 -2
  32. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_stream_socket.hpp +2 -2
  33. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_waitable_timer.hpp +2 -2
  34. data/src/cxx_supportlib/vendor-modified/boost/asio/basic_writable_pipe.hpp +2 -2
  35. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_allocator.hpp +13 -3
  36. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_cancellation_slot.hpp +14 -3
  37. data/src/cxx_supportlib/vendor-modified/boost/asio/bind_executor.hpp +13 -3
  38. data/src/cxx_supportlib/vendor-modified/boost/asio/compose.hpp +30 -305
  39. data/src/cxx_supportlib/vendor-modified/boost/asio/consign.hpp +90 -0
  40. data/src/cxx_supportlib/vendor-modified/boost/asio/defer.hpp +17 -18
  41. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/bind_handler.hpp +98 -24
  42. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/composed_work.hpp +330 -0
  43. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/config.hpp +81 -15
  44. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_alloc_helpers.hpp +4 -4
  45. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/handler_work.hpp +19 -11
  46. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/descriptor_ops.ipp +37 -0
  47. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/handler_tracking.ipp +3 -1
  48. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/select_reactor.ipp +1 -1
  49. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/socket_ops.ipp +10 -2
  50. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/impl/strand_executor_service.hpp +14 -1
  51. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/memory.hpp +18 -0
  52. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/utility.hpp +1 -2
  53. data/src/cxx_supportlib/vendor-modified/boost/asio/detail/work_dispatcher.hpp +7 -3
  54. data/src/cxx_supportlib/vendor-modified/boost/asio/dispatch.hpp +4 -14
  55. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/allocator.hpp +22 -3
  56. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/any_executor.hpp +447 -142
  57. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking.hpp +57 -8
  58. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/blocking_adaptation.hpp +51 -6
  59. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/bulk_execute.hpp +5 -0
  60. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/bulk_guarantee.hpp +41 -4
  61. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/connect.hpp +5 -0
  62. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/context.hpp +13 -2
  63. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/context_as.hpp +13 -2
  64. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/detail/as_operation.hpp +4 -0
  65. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/execute.hpp +9 -2
  66. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/executor.hpp +11 -1
  67. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/mapping.hpp +52 -8
  68. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/occupancy.hpp +13 -2
  69. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/operation_state.hpp +5 -0
  70. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/outstanding_work.hpp +39 -6
  71. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/receiver.hpp +5 -0
  72. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/relationship.hpp +39 -6
  73. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/schedule.hpp +5 -0
  74. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/scheduler.hpp +5 -0
  75. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/sender.hpp +5 -0
  76. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_done.hpp +5 -0
  77. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_error.hpp +5 -0
  78. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/set_value.hpp +5 -0
  79. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/start.hpp +5 -0
  80. data/src/cxx_supportlib/vendor-modified/boost/asio/execution/submit.hpp +5 -0
  81. data/src/cxx_supportlib/vendor-modified/boost/asio/executor_work_guard.hpp +6 -9
  82. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_channel.hpp +3 -3
  83. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/basic_concurrent_channel.hpp +3 -3
  84. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/channel_traits.hpp +70 -0
  85. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/co_composed.hpp +146 -0
  86. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/coro.hpp +35 -5
  87. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_handler.hpp +13 -3
  88. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_operation.hpp +7 -0
  89. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/channel_service.hpp +180 -0
  90. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/coro_completion_handler.hpp +171 -0
  91. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/coro_promise_allocator.hpp +89 -66
  92. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/partial_promise.hpp +66 -45
  93. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/as_single.hpp +13 -3
  94. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/co_composed.hpp +1134 -0
  95. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/coro.hpp +130 -106
  96. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/parallel_group.hpp +377 -3
  97. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/promise.hpp +168 -29
  98. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/use_coro.hpp +149 -203
  99. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/impl/use_promise.hpp +68 -0
  100. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/parallel_group.hpp +256 -0
  101. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/promise.hpp +76 -80
  102. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_coro.hpp +40 -14
  103. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/use_promise.hpp +113 -0
  104. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/any_completion_executor.ipp +132 -0
  105. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/any_io_executor.ipp +12 -0
  106. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/append.hpp +12 -3
  107. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/as_tuple.hpp +12 -3
  108. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_read_stream.hpp +25 -6
  109. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/buffered_write_stream.hpp +25 -6
  110. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/co_spawn.hpp +34 -45
  111. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/connect.hpp +28 -6
  112. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/consign.hpp +204 -0
  113. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/defer.hpp +33 -1
  114. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/deferred.hpp +13 -3
  115. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/dispatch.hpp +21 -9
  116. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/handler_alloc_hook.ipp +1 -1
  117. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/post.hpp +33 -1
  118. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/prepend.hpp +12 -3
  119. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read.hpp +40 -9
  120. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_at.hpp +27 -6
  121. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/read_until.hpp +104 -24
  122. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/redirect_error.hpp +12 -3
  123. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/spawn.hpp +70 -15
  124. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/src.hpp +1 -0
  125. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/use_future.hpp +25 -0
  126. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write.hpp +38 -30
  127. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/write_at.hpp +27 -6
  128. data/src/cxx_supportlib/vendor-modified/boost/asio/io_context.hpp +0 -13
  129. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v4.ipp +3 -1
  130. data/src/cxx_supportlib/vendor-modified/boost/asio/ip/impl/network_v6.ipp +3 -1
  131. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_descriptor.hpp +2 -2
  132. data/src/cxx_supportlib/vendor-modified/boost/asio/posix/basic_stream_descriptor.hpp +2 -2
  133. data/src/cxx_supportlib/vendor-modified/boost/asio/post.hpp +17 -18
  134. data/src/cxx_supportlib/vendor-modified/boost/asio/spawn.hpp +3 -1
  135. data/src/cxx_supportlib/vendor-modified/boost/asio/ssl/detail/io.hpp +13 -3
  136. data/src/cxx_supportlib/vendor-modified/boost/asio/strand.hpp +11 -7
  137. data/src/cxx_supportlib/vendor-modified/boost/asio/system_executor.hpp +0 -13
  138. data/src/cxx_supportlib/vendor-modified/boost/asio/thread_pool.hpp +23 -18
  139. data/src/cxx_supportlib/vendor-modified/boost/asio/version.hpp +1 -1
  140. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_object_handle.hpp +2 -2
  141. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_overlapped_handle.hpp +1 -1
  142. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_random_access_handle.hpp +2 -2
  143. data/src/cxx_supportlib/vendor-modified/boost/asio/windows/basic_stream_handle.hpp +2 -2
  144. data/src/cxx_supportlib/vendor-modified/boost/asio.hpp +4 -0
  145. data/src/cxx_supportlib/vendor-modified/boost/bind/bind.hpp +1 -1
  146. data/src/cxx_supportlib/vendor-modified/boost/chrono/config.hpp +1 -0
  147. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/inlined/mac/chrono.hpp +4 -4
  148. data/src/cxx_supportlib/vendor-modified/boost/chrono/detail/scan_keyword.hpp +4 -2
  149. data/src/cxx_supportlib/vendor-modified/boost/chrono/duration.hpp +2 -2
  150. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_io.hpp +3 -3
  151. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_put.hpp +5 -5
  152. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/duration_units.hpp +2 -2
  153. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/time_point_io.hpp +2 -2
  154. data/src/cxx_supportlib/vendor-modified/boost/chrono/io/utility/ios_base_state_ptr.hpp +7 -7
  155. data/src/cxx_supportlib/vendor-modified/boost/chrono/time_point.hpp +1 -1
  156. data/src/cxx_supportlib/vendor-modified/boost/circular_buffer/details.hpp +5 -1
  157. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang.hpp +10 -3
  158. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/clang_version.hpp +9 -3
  159. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/gcc.hpp +9 -3
  160. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/sunpro_cc.hpp +6 -0
  161. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/visualc.hpp +8 -0
  162. data/src/cxx_supportlib/vendor-modified/boost/config/compiler/xlcpp.hpp +4 -0
  163. data/src/cxx_supportlib/vendor-modified/boost/config/detail/suffix.hpp +33 -0
  164. data/src/cxx_supportlib/vendor-modified/boost/config/header_deprecated.hpp +1 -1
  165. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libcpp.hpp +9 -0
  166. data/src/cxx_supportlib/vendor-modified/boost/config/stdlib/libstdcpp3.hpp +4 -2
  167. data/src/cxx_supportlib/vendor-modified/boost/container/allocator.hpp +1 -1
  168. data/src/cxx_supportlib/vendor-modified/boost/container/container_fwd.hpp +29 -0
  169. data/src/cxx_supportlib/vendor-modified/boost/container/deque.hpp +13 -13
  170. data/src/cxx_supportlib/vendor-modified/boost/container/detail/advanced_insert_int.hpp +80 -95
  171. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_begin.hpp +10 -0
  172. data/src/cxx_supportlib/vendor-modified/boost/container/detail/config_end.hpp +3 -0
  173. data/src/cxx_supportlib/vendor-modified/boost/container/detail/copy_move_algo.hpp +738 -34
  174. data/src/cxx_supportlib/vendor-modified/boost/container/detail/destroyers.hpp +38 -10
  175. data/src/cxx_supportlib/vendor-modified/boost/container/detail/flat_tree.hpp +1 -0
  176. data/src/cxx_supportlib/vendor-modified/boost/container/detail/iterator.hpp +2 -0
  177. data/src/cxx_supportlib/vendor-modified/boost/container/detail/workaround.hpp +3 -4
  178. data/src/cxx_supportlib/vendor-modified/boost/container/devector.hpp +1150 -1213
  179. data/src/cxx_supportlib/vendor-modified/boost/container/node_allocator.hpp +1 -1
  180. data/src/cxx_supportlib/vendor-modified/boost/container/options.hpp +104 -12
  181. data/src/cxx_supportlib/vendor-modified/boost/container/stable_vector.hpp +1 -0
  182. data/src/cxx_supportlib/vendor-modified/boost/container/string.hpp +11 -1
  183. data/src/cxx_supportlib/vendor-modified/boost/container/vector.hpp +31 -331
  184. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_mix.hpp +113 -0
  185. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_range.hpp +173 -0
  186. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_tuple.hpp +133 -0
  187. data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash.hpp +461 -566
  188. data/src/cxx_supportlib/vendor-modified/boost/container_hash/hash_fwd.hpp +24 -24
  189. data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_contiguous_range.hpp +91 -0
  190. data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_described_class.hpp +38 -0
  191. data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_range.hpp +73 -0
  192. data/src/cxx_supportlib/vendor-modified/boost/container_hash/is_unordered_range.hpp +39 -0
  193. data/src/cxx_supportlib/vendor-modified/boost/core/bit.hpp +32 -4
  194. data/src/cxx_supportlib/vendor-modified/boost/core/detail/string_view.hpp +16 -0
  195. data/src/cxx_supportlib/vendor-modified/boost/core/empty_value.hpp +16 -16
  196. data/src/cxx_supportlib/vendor-modified/boost/core/fclose_deleter.hpp +46 -0
  197. data/src/cxx_supportlib/vendor-modified/boost/date_time/date.hpp +1 -1
  198. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/formatters.hpp +3 -3
  199. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/formatters_limited.hpp +3 -3
  200. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/greg_date.hpp +12 -13
  201. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian/parsers.hpp +2 -2
  202. data/src/cxx_supportlib/vendor-modified/boost/date_time/gregorian_calendar.ipp +2 -2
  203. data/src/cxx_supportlib/vendor-modified/boost/date_time/iso_format.hpp +13 -13
  204. data/src/cxx_supportlib/vendor-modified/boost/date_time/local_time/local_date_time.hpp +2 -2
  205. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/time_formatters.hpp +4 -4
  206. data/src/cxx_supportlib/vendor-modified/boost/date_time/posix_time/time_formatters_limited.hpp +2 -2
  207. data/src/cxx_supportlib/vendor-modified/boost/date_time/special_values_parser.hpp +1 -1
  208. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_facet.hpp +1 -1
  209. data/src/cxx_supportlib/vendor-modified/boost/date_time/time_parsing.hpp +2 -2
  210. data/src/cxx_supportlib/vendor-modified/boost/describe/bases.hpp +50 -0
  211. data/src/cxx_supportlib/vendor-modified/boost/describe/detail/config.hpp +40 -0
  212. data/src/cxx_supportlib/vendor-modified/boost/describe/detail/cx_streq.hpp +30 -0
  213. data/src/cxx_supportlib/vendor-modified/boost/describe/detail/void_t.hpp +32 -0
  214. data/src/cxx_supportlib/vendor-modified/boost/describe/members.hpp +159 -0
  215. data/src/cxx_supportlib/vendor-modified/boost/describe/modifiers.hpp +33 -0
  216. data/src/cxx_supportlib/vendor-modified/boost/intrusive/avltree_algorithms.hpp +9 -9
  217. data/src/cxx_supportlib/vendor-modified/boost/intrusive/bstree_algorithms.hpp +45 -45
  218. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/any_node_and_algorithms.hpp +8 -8
  219. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/bstree_algorithms_base.hpp +37 -38
  220. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/iterator.hpp +16 -0
  221. data/src/cxx_supportlib/vendor-modified/boost/intrusive/detail/workaround.hpp +1 -1
  222. data/src/cxx_supportlib/vendor-modified/boost/intrusive/hashtable.hpp +145 -90
  223. data/src/cxx_supportlib/vendor-modified/boost/intrusive/pack_options.hpp +2 -0
  224. data/src/cxx_supportlib/vendor-modified/boost/intrusive/rbtree_algorithms.hpp +7 -7
  225. data/src/cxx_supportlib/vendor-modified/boost/intrusive/sgtree_algorithms.hpp +5 -5
  226. data/src/cxx_supportlib/vendor-modified/boost/intrusive/splaytree_algorithms.hpp +11 -9
  227. data/src/cxx_supportlib/vendor-modified/boost/intrusive/treap_algorithms.hpp +7 -7
  228. data/src/cxx_supportlib/vendor-modified/boost/iterator/iterator_facade.hpp +106 -25
  229. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_lexical_streams.hpp +1 -1
  230. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/converter_numeric.hpp +8 -5
  231. data/src/cxx_supportlib/vendor-modified/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +1 -1
  232. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/adaptive_sort_merge.hpp +4 -2
  233. data/src/cxx_supportlib/vendor-modified/boost/move/algo/detail/pdqsort.hpp +2 -1
  234. data/src/cxx_supportlib/vendor-modified/boost/move/detail/type_traits.hpp +8 -4
  235. data/src/cxx_supportlib/vendor-modified/boost/mp11/bind.hpp +111 -0
  236. data/src/cxx_supportlib/vendor-modified/boost/mp11/version.hpp +1 -1
  237. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/int_float_mixture.hpp +5 -5
  238. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/sign_mixture.hpp +5 -5
  239. data/src/cxx_supportlib/vendor-modified/boost/numeric/conversion/detail/udt_builtin_mixture.hpp +5 -5
  240. data/src/cxx_supportlib/vendor-modified/boost/preprocessor/variadic/has_opt.hpp +6 -2
  241. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/detail/spinlock_gcc_atomic.hpp +11 -2
  242. data/src/cxx_supportlib/vendor-modified/boost/smart_ptr/intrusive_ptr.hpp +1 -1
  243. data/src/cxx_supportlib/vendor-modified/boost/system/detail/config.hpp +7 -1
  244. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category.hpp +2 -2
  245. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_category_impl.hpp +10 -1
  246. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_code.hpp +38 -43
  247. data/src/cxx_supportlib/vendor-modified/boost/system/detail/error_condition.hpp +52 -0
  248. data/src/cxx_supportlib/vendor-modified/boost/throw_exception.hpp +1 -1
  249. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_function_ptr_helper.hpp +27 -27
  250. data/src/cxx_supportlib/vendor-modified/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +27 -27
  251. data/src/cxx_supportlib/vendor-modified/boost/type_traits/intrinsics.hpp +22 -8
  252. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/fca.hpp +37 -7
  253. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/foa.hpp +1921 -0
  254. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/implementation.hpp +66 -82
  255. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/prime_fmod.hpp +6 -0
  256. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/type_traits.hpp +109 -0
  257. data/src/cxx_supportlib/vendor-modified/boost/unordered/detail/xmx.hpp +75 -0
  258. data/src/cxx_supportlib/vendor-modified/boost/unordered/hash_traits.hpp +45 -0
  259. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map.hpp +732 -0
  260. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_map_fwd.hpp +49 -0
  261. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set.hpp +586 -0
  262. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_flat_set_fwd.hpp +49 -0
  263. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_map.hpp +166 -66
  264. data/src/cxx_supportlib/vendor-modified/boost/unordered/unordered_set.hpp +145 -28
  265. data/src/cxx_supportlib/vendor-modified/boost/version.hpp +2 -2
  266. data/src/cxx_supportlib/vendor-modified/websocketpp/websocketpp/common/md5.hpp +1 -1
  267. data/src/ruby_native_extension/extconf.rb +1 -1
  268. data/src/ruby_supportlib/phusion_passenger/native_support.rb +4 -2
  269. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +1 -1
  270. data/src/ruby_supportlib/phusion_passenger/public_api.rb +3 -0
  271. data/src/ruby_supportlib/phusion_passenger/utils.rb +1 -0
  272. data/src/ruby_supportlib/phusion_passenger.rb +5 -5
  273. metadata +36 -19
  274. data/src/cxx_supportlib/vendor-modified/boost/align/align.hpp +0 -19
  275. data/src/cxx_supportlib/vendor-modified/boost/align/alignment_of.hpp +0 -54
  276. data/src/cxx_supportlib/vendor-modified/boost/align/alignment_of_forward.hpp +0 -20
  277. data/src/cxx_supportlib/vendor-modified/boost/align/detail/align_cxx11.hpp +0 -21
  278. data/src/cxx_supportlib/vendor-modified/boost/align/detail/aligned_alloc.hpp +0 -52
  279. data/src/cxx_supportlib/vendor-modified/boost/align/detail/alignment_of.hpp +0 -31
  280. data/src/cxx_supportlib/vendor-modified/boost/align/detail/alignment_of_cxx11.hpp +0 -23
  281. data/src/cxx_supportlib/vendor-modified/boost/align/detail/element_type.hpp +0 -91
  282. data/src/cxx_supportlib/vendor-modified/boost/align/detail/integral_constant.hpp +0 -53
  283. data/src/cxx_supportlib/vendor-modified/boost/align/detail/min_size.hpp +0 -26
  284. data/src/cxx_supportlib/vendor-modified/boost/asio/experimental/detail/completion_handler_erasure.hpp +0 -196
  285. data/src/cxx_supportlib/vendor-modified/boost/asio/impl/compose.hpp +0 -709
  286. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/float_functions.hpp +0 -336
  287. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/hash_float.hpp +0 -271
  288. data/src/cxx_supportlib/vendor-modified/boost/container_hash/detail/limits.hpp +0 -62
  289. data/src/cxx_supportlib/vendor-modified/boost/container_hash/extensions.hpp +0 -361
  290. data/src/cxx_supportlib/vendor-modified/boost/detail/container_fwd.hpp +0 -157
@@ -17,6 +17,7 @@
17
17
 
18
18
  #include <boost/asio/detail/config.hpp>
19
19
  #include <atomic>
20
+ #include <deque>
20
21
  #include <memory>
21
22
  #include <new>
22
23
  #include <tuple>
@@ -393,6 +394,342 @@ void parallel_group_launch(Condition cancellation_condition, Handler handler,
393
394
  Condition, Handler, Ops...> >(state);
394
395
  }
395
396
 
397
+ // Proxy completion handler for the ranged group of parallel operatations.
398
+ // Unpacks and recombines the individual operations' results, and invokes the
399
+ // user's completion handler.
400
+ template <typename Handler, typename Op, typename Allocator>
401
+ struct ranged_parallel_group_completion_handler
402
+ {
403
+ typedef typename decay<
404
+ typename prefer_result<
405
+ typename associated_executor<Handler>::type,
406
+ execution::outstanding_work_t::tracked_t
407
+ >::type
408
+ >::type executor_type;
409
+
410
+ typedef typename parallel_op_signature_as_tuple<
411
+ typename completion_signature_of<Op>::type
412
+ >::type op_tuple_type;
413
+
414
+ typedef parallel_group_op_result<op_tuple_type> op_result_type;
415
+
416
+ ranged_parallel_group_completion_handler(Handler&& h,
417
+ std::size_t size, const Allocator& allocator)
418
+ : handler_(std::move(h)),
419
+ executor_(
420
+ boost::asio::prefer(
421
+ boost::asio::get_associated_executor(handler_),
422
+ execution::outstanding_work.tracked)),
423
+ allocator_(allocator),
424
+ completion_order_(size, 0,
425
+ BOOST_ASIO_REBIND_ALLOC(Allocator, std::size_t)(allocator)),
426
+ args_(BOOST_ASIO_REBIND_ALLOC(Allocator, op_result_type)(allocator))
427
+ {
428
+ for (std::size_t i = 0; i < size; ++i)
429
+ args_.emplace_back();
430
+ }
431
+
432
+ executor_type get_executor() const noexcept
433
+ {
434
+ return executor_;
435
+ }
436
+
437
+ void operator()()
438
+ {
439
+ this->invoke(
440
+ boost::asio::detail::make_index_sequence<
441
+ std::tuple_size<op_tuple_type>::value>());
442
+ }
443
+
444
+ template <std::size_t... I>
445
+ void invoke(boost::asio::detail::index_sequence<I...>)
446
+ {
447
+ typedef typename parallel_op_signature_as_tuple<
448
+ typename ranged_parallel_group_signature<
449
+ typename completion_signature_of<Op>::type,
450
+ Allocator
451
+ >::raw_type
452
+ >::type vectors_type;
453
+
454
+ // Construct all result vectors using the supplied allocator.
455
+ vectors_type vectors{
456
+ typename std::tuple_element<I, vectors_type>::type(
457
+ BOOST_ASIO_REBIND_ALLOC(Allocator, int)(allocator_))...};
458
+
459
+ // Reserve sufficient space in each of the result vectors.
460
+ int reserve_fold[] = { 0,
461
+ ( std::get<I>(vectors).reserve(completion_order_.size()),
462
+ 0 )...
463
+ };
464
+ (void)reserve_fold;
465
+
466
+ // Copy the results from all operations into the result vectors.
467
+ for (std::size_t idx = 0; idx < completion_order_.size(); ++idx)
468
+ {
469
+ int pushback_fold[] = { 0,
470
+ ( std::get<I>(vectors).push_back(
471
+ std::move(std::get<I>(args_[idx].get()))),
472
+ 0 )...
473
+ };
474
+ (void)pushback_fold;
475
+ }
476
+
477
+ std::move(handler_)(completion_order_, std::move(std::get<I>(vectors))...);
478
+ }
479
+
480
+ Handler handler_;
481
+ executor_type executor_;
482
+ Allocator allocator_;
483
+ std::vector<std::size_t,
484
+ BOOST_ASIO_REBIND_ALLOC(Allocator, std::size_t)> completion_order_;
485
+ std::deque<op_result_type,
486
+ BOOST_ASIO_REBIND_ALLOC(Allocator, op_result_type)> args_;
487
+ };
488
+
489
+ // Shared state for the parallel group.
490
+ template <typename Condition, typename Handler, typename Op, typename Allocator>
491
+ struct ranged_parallel_group_state
492
+ {
493
+ ranged_parallel_group_state(Condition&& c, Handler&& h,
494
+ std::size_t size, const Allocator& allocator)
495
+ : cancellations_requested_(size),
496
+ outstanding_(size),
497
+ cancellation_signals_(
498
+ BOOST_ASIO_REBIND_ALLOC(Allocator,
499
+ boost::asio::cancellation_signal)(allocator)),
500
+ cancellation_condition_(std::move(c)),
501
+ handler_(std::move(h), size, allocator)
502
+ {
503
+ for (std::size_t i = 0; i < size; ++i)
504
+ cancellation_signals_.emplace_back();
505
+ }
506
+
507
+ // The number of operations that have completed so far. Used to determine the
508
+ // order of completion.
509
+ std::atomic<unsigned int> completed_{0};
510
+
511
+ // The non-none cancellation type that resulted from a cancellation condition.
512
+ // Stored here for use by the group's initiating function.
513
+ std::atomic<cancellation_type_t> cancel_type_{cancellation_type::none};
514
+
515
+ // The number of cancellations that have been requested, either on completion
516
+ // of the operations within the group, or via the cancellation slot for the
517
+ // group operation. Initially set to the number of operations to prevent
518
+ // cancellation signals from being emitted until after all of the group's
519
+ // operations' initiating functions have completed.
520
+ std::atomic<unsigned int> cancellations_requested_;
521
+
522
+ // The number of operations that are yet to complete. Used to determine when
523
+ // it is safe to invoke the user's completion handler.
524
+ std::atomic<unsigned int> outstanding_;
525
+
526
+ // The cancellation signals for each operation in the group.
527
+ std::deque<boost::asio::cancellation_signal,
528
+ BOOST_ASIO_REBIND_ALLOC(Allocator, boost::asio::cancellation_signal)>
529
+ cancellation_signals_;
530
+
531
+ // The cancellation condition is used to determine whether the results from an
532
+ // individual operation warrant a cancellation request for the whole group.
533
+ Condition cancellation_condition_;
534
+
535
+ // The proxy handler to be invoked once all operations in the group complete.
536
+ ranged_parallel_group_completion_handler<Handler, Op, Allocator> handler_;
537
+ };
538
+
539
+ // Handler for an individual operation within the parallel group.
540
+ template <typename Condition, typename Handler, typename Op, typename Allocator>
541
+ struct ranged_parallel_group_op_handler
542
+ {
543
+ typedef boost::asio::cancellation_slot cancellation_slot_type;
544
+
545
+ ranged_parallel_group_op_handler(
546
+ std::shared_ptr<ranged_parallel_group_state<
547
+ Condition, Handler, Op, Allocator> > state,
548
+ std::size_t idx)
549
+ : state_(std::move(state)),
550
+ idx_(idx)
551
+ {
552
+ }
553
+
554
+ cancellation_slot_type get_cancellation_slot() const noexcept
555
+ {
556
+ return state_->cancellation_signals_[idx_].slot();
557
+ }
558
+
559
+ template <typename... Args>
560
+ void operator()(Args... args)
561
+ {
562
+ // Capture this operation into the completion order.
563
+ state_->handler_.completion_order_[state_->completed_++] = idx_;
564
+
565
+ // Determine whether the results of this operation require cancellation of
566
+ // the whole group.
567
+ cancellation_type_t cancel_type = state_->cancellation_condition_(args...);
568
+
569
+ // Capture the result of the operation into the proxy completion handler.
570
+ state_->handler_.args_[idx_].emplace(std::move(args)...);
571
+
572
+ if (cancel_type != cancellation_type::none)
573
+ {
574
+ // Save the type for potential use by the group's initiating function.
575
+ state_->cancel_type_ = cancel_type;
576
+
577
+ // If we are the first operation to request cancellation, emit a signal
578
+ // for each operation in the group.
579
+ if (state_->cancellations_requested_++ == 0)
580
+ for (std::size_t i = 0; i < state_->cancellation_signals_.size(); ++i)
581
+ if (i != idx_)
582
+ state_->cancellation_signals_[i].emit(cancel_type);
583
+ }
584
+
585
+ // If this is the last outstanding operation, invoke the user's handler.
586
+ if (--state_->outstanding_ == 0)
587
+ boost::asio::dispatch(std::move(state_->handler_));
588
+ }
589
+
590
+ std::shared_ptr<ranged_parallel_group_state<
591
+ Condition, Handler, Op, Allocator> > state_;
592
+ std::size_t idx_;
593
+ };
594
+
595
+ // Handler for an individual operation within the parallel group that has an
596
+ // explicitly specified executor.
597
+ template <typename Executor, typename Condition,
598
+ typename Handler, typename Op, typename Allocator>
599
+ struct ranged_parallel_group_op_handler_with_executor :
600
+ ranged_parallel_group_op_handler<Condition, Handler, Op, Allocator>
601
+ {
602
+ typedef ranged_parallel_group_op_handler<
603
+ Condition, Handler, Op, Allocator> base_type;
604
+ typedef boost::asio::cancellation_slot cancellation_slot_type;
605
+ typedef Executor executor_type;
606
+
607
+ ranged_parallel_group_op_handler_with_executor(
608
+ std::shared_ptr<ranged_parallel_group_state<
609
+ Condition, Handler, Op, Allocator> > state,
610
+ executor_type ex, std::size_t idx)
611
+ : ranged_parallel_group_op_handler<Condition, Handler, Op, Allocator>(
612
+ std::move(state), idx)
613
+ {
614
+ cancel_proxy_ =
615
+ &this->state_->cancellation_signals_[idx].slot().template
616
+ emplace<cancel_proxy>(this->state_, std::move(ex));
617
+ }
618
+
619
+ cancellation_slot_type get_cancellation_slot() const noexcept
620
+ {
621
+ return cancel_proxy_->signal_.slot();
622
+ }
623
+
624
+ executor_type get_executor() const noexcept
625
+ {
626
+ return cancel_proxy_->executor_;
627
+ }
628
+
629
+ // Proxy handler that forwards the emitted signal to the correct executor.
630
+ struct cancel_proxy
631
+ {
632
+ cancel_proxy(
633
+ std::shared_ptr<ranged_parallel_group_state<
634
+ Condition, Handler, Op, Allocator> > state,
635
+ executor_type ex)
636
+ : state_(std::move(state)),
637
+ executor_(std::move(ex))
638
+ {
639
+ }
640
+
641
+ void operator()(cancellation_type_t type)
642
+ {
643
+ if (auto state = state_.lock())
644
+ {
645
+ boost::asio::cancellation_signal* sig = &signal_;
646
+ boost::asio::dispatch(executor_,
647
+ [state, sig, type]{ sig->emit(type); });
648
+ }
649
+ }
650
+
651
+ std::weak_ptr<ranged_parallel_group_state<
652
+ Condition, Handler, Op, Allocator> > state_;
653
+ boost::asio::cancellation_signal signal_;
654
+ executor_type executor_;
655
+ };
656
+
657
+ cancel_proxy* cancel_proxy_;
658
+ };
659
+
660
+ template <typename Condition, typename Handler, typename Op, typename Allocator>
661
+ struct ranged_parallel_group_cancellation_handler
662
+ {
663
+ ranged_parallel_group_cancellation_handler(
664
+ std::shared_ptr<ranged_parallel_group_state<
665
+ Condition, Handler, Op, Allocator> > state)
666
+ : state_(std::move(state))
667
+ {
668
+ }
669
+
670
+ void operator()(cancellation_type_t cancel_type)
671
+ {
672
+ // If we are the first place to request cancellation, i.e. no operation has
673
+ // yet completed and requested cancellation, emit a signal for each
674
+ // operation in the group.
675
+ if (cancel_type != cancellation_type::none)
676
+ if (auto state = state_.lock())
677
+ if (state->cancellations_requested_++ == 0)
678
+ for (std::size_t i = 0; i < state->cancellation_signals_.size(); ++i)
679
+ state->cancellation_signals_[i].emit(cancel_type);
680
+ }
681
+
682
+ std::weak_ptr<ranged_parallel_group_state<
683
+ Condition, Handler, Op, Allocator> > state_;
684
+ };
685
+
686
+ template <typename Condition, typename Handler,
687
+ typename Range, typename Allocator>
688
+ void ranged_parallel_group_launch(Condition cancellation_condition,
689
+ Handler handler, Range&& range, const Allocator& allocator)
690
+ {
691
+ // Get the user's completion handler's cancellation slot, so that we can allow
692
+ // cancellation of the entire group.
693
+ typename associated_cancellation_slot<Handler>::type slot
694
+ = boost::asio::get_associated_cancellation_slot(handler);
695
+
696
+ // The type of the asynchronous operation.
697
+ typedef typename std::decay<decltype(
698
+ *std::declval<typename Range::iterator>())>::type op_type;
699
+
700
+ // Create the shared state for the operation.
701
+ typedef ranged_parallel_group_state<Condition,
702
+ Handler, op_type, Allocator> state_type;
703
+ std::shared_ptr<state_type> state = std::allocate_shared<state_type>(
704
+ boost::asio::detail::recycling_allocator<state_type,
705
+ boost::asio::detail::thread_info_base::parallel_group_tag>(),
706
+ std::move(cancellation_condition),
707
+ std::move(handler), range.size(), allocator);
708
+
709
+ std::size_t idx = 0;
710
+ for (auto&& op : std::forward<Range>(range))
711
+ {
712
+ typedef typename associated_executor<op_type>::type ex_type;
713
+ ex_type ex = boost::asio::get_associated_executor(op);
714
+ std::move(op)(
715
+ ranged_parallel_group_op_handler_with_executor<
716
+ ex_type, Condition, Handler, op_type, Allocator>(
717
+ state, std::move(ex), idx++));
718
+ }
719
+
720
+ // Check if any of the operations has already requested cancellation, and if
721
+ // so, emit a signal for each operation in the group.
722
+ if ((state->cancellations_requested_ -= range.size()) > 0)
723
+ for (auto& signal : state->cancellation_signals_)
724
+ signal.emit(state->cancel_type_);
725
+
726
+ // Register a handler with the user's completion handler's cancellation slot.
727
+ if (slot.is_connected())
728
+ slot.template emplace<
729
+ ranged_parallel_group_cancellation_handler<
730
+ Condition, Handler, op_type, Allocator> >(state);
731
+ }
732
+
396
733
  } // namespace detail
397
734
  } // namespace experimental
398
735
 
@@ -403,10 +740,47 @@ struct associator<Associator,
403
740
  DefaultCandidate>
404
741
  : Associator<Handler, DefaultCandidate>
405
742
  {
406
- static typename Associator<Handler, DefaultCandidate>::type get(
407
- const experimental::detail::parallel_group_completion_handler<
743
+ static typename Associator<Handler, DefaultCandidate>::type
744
+ get(const experimental::detail::parallel_group_completion_handler<
745
+ Handler, Ops...>& h) BOOST_ASIO_NOEXCEPT
746
+ {
747
+ return Associator<Handler, DefaultCandidate>::get(h.handler_);
748
+ }
749
+
750
+ static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
751
+ typename Associator<Handler, DefaultCandidate>::type)
752
+ get(const experimental::detail::parallel_group_completion_handler<
408
753
  Handler, Ops...>& h,
409
- const DefaultCandidate& c = DefaultCandidate()) BOOST_ASIO_NOEXCEPT
754
+ const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
755
+ BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
756
+ Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
757
+ {
758
+ return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
759
+ }
760
+ };
761
+
762
+ template <template <typename, typename> class Associator, typename Handler,
763
+ typename Op, typename Allocator, typename DefaultCandidate>
764
+ struct associator<Associator,
765
+ experimental::detail::ranged_parallel_group_completion_handler<
766
+ Handler, Op, Allocator>,
767
+ DefaultCandidate>
768
+ : Associator<Handler, DefaultCandidate>
769
+ {
770
+ static typename Associator<Handler, DefaultCandidate>::type
771
+ get(const experimental::detail::ranged_parallel_group_completion_handler<
772
+ Handler, Op, Allocator>& h) BOOST_ASIO_NOEXCEPT
773
+ {
774
+ return Associator<Handler, DefaultCandidate>::get(h.handler_);
775
+ }
776
+
777
+ static BOOST_ASIO_AUTO_RETURN_TYPE_PREFIX2(
778
+ typename Associator<Handler, DefaultCandidate>::type)
779
+ get(const experimental::detail::ranged_parallel_group_completion_handler<
780
+ Handler, Op, Allocator>& h,
781
+ const DefaultCandidate& c) BOOST_ASIO_NOEXCEPT
782
+ BOOST_ASIO_AUTO_RETURN_TYPE_SUFFIX((
783
+ Associator<Handler, DefaultCandidate>::get(h.handler_, c)))
410
784
  {
411
785
  return Associator<Handler, DefaultCandidate>::get(h.handler_, c);
412
786
  }
@@ -15,10 +15,10 @@
15
15
  # pragma once
16
16
  #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
17
 
18
+ #include <boost/asio/detail/config.hpp>
18
19
  #include <boost/asio/cancellation_signal.hpp>
19
- #include <boost/asio/experimental/detail/completion_handler_erasure.hpp>
20
+ #include <boost/asio/detail/utility.hpp>
20
21
  #include <tuple>
21
- #include <optional>
22
22
 
23
23
  #include <boost/asio/detail/push_options.hpp>
24
24
 
@@ -26,51 +26,171 @@ namespace boost {
26
26
  namespace asio {
27
27
  namespace experimental {
28
28
 
29
- template<typename Signature = void(), typename Executor = any_io_executor>
29
+ template<typename Signature = void(),
30
+ typename Executor = boost::asio::any_io_executor,
31
+ typename Allocator = std::allocator<void>>
30
32
  struct promise;
31
33
 
32
34
  namespace detail {
33
35
 
34
- template<typename Signature, typename Executor>
36
+ template<typename Signature, typename Executor, typename Allocator>
35
37
  struct promise_impl;
36
38
 
37
- template<typename ... Ts, typename Executor>
38
- struct promise_impl<void(Ts...), Executor>
39
+ template<typename... Ts, typename Executor, typename Allocator>
40
+ struct promise_impl<void(Ts...), Executor, Allocator>
39
41
  {
40
42
  using result_type = std::tuple<Ts...>;
41
43
 
42
- promise_impl(Executor executor = {})
43
- : executor(std::move(executor))
44
+ promise_impl(Allocator allocator, Executor executor)
45
+ : allocator(std::move(allocator)), executor(std::move(executor))
44
46
  {
45
47
  }
46
48
 
47
- std::optional<result_type> result;
48
- bool done{false};
49
- detail::completion_handler_erasure<void(Ts...), Executor> completion;
49
+ promise_impl(const promise_impl&) = delete;
50
+
51
+ ~promise_impl()
52
+ {
53
+ if (completion)
54
+ this->cancel_();
55
+
56
+ if (done)
57
+ reinterpret_cast<result_type*>(&result)->~result_type();
58
+ }
59
+
60
+ typename aligned_storage<sizeof(result_type),
61
+ alignof(result_type)>::type result;
62
+ std::atomic<bool> done{false};
50
63
  cancellation_signal cancel;
64
+ Allocator allocator;
51
65
  Executor executor;
52
- };
53
66
 
54
- template<typename Signature = void(), typename Executor = any_io_executor>
55
- struct promise_handler;
67
+ template<typename Func, std::size_t... Idx>
68
+ void apply_impl(Func f, boost::asio::detail::index_sequence<Idx...>)
69
+ {
70
+ auto& result_type = *reinterpret_cast<promise_impl::result_type*>(&result);
71
+ f(std::get<Idx>(std::move(result_type))...);
72
+ }
73
+
74
+ using allocator_type = Allocator;
75
+ allocator_type get_allocator() {return allocator;}
76
+
77
+ using executor_type = Executor;
78
+ executor_type get_executor() {return executor;}
79
+
80
+ template<typename Func>
81
+ void apply(Func f)
82
+ {
83
+ apply_impl(std::forward<Func>(f),
84
+ boost::asio::detail::make_index_sequence<sizeof...(Ts)>{});
85
+ }
86
+
87
+ struct completion_base
88
+ {
89
+ virtual void invoke(Ts&&...ts) = 0;
90
+ };
91
+
92
+ template<typename Alloc, typename WaitHandler_>
93
+ struct completion_impl final : completion_base
94
+ {
95
+ WaitHandler_ handler;
96
+ Alloc allocator;
97
+ void invoke(Ts&&... ts)
98
+ {
99
+ auto h = std::move(handler);
100
+
101
+ using alloc_t = typename std::allocator_traits<
102
+ typename boost::asio::decay<Alloc>::type>::template
103
+ rebind_alloc<completion_impl>;
104
+
105
+ alloc_t alloc_{allocator};
106
+ this->~completion_impl();
107
+ std::allocator_traits<alloc_t>::deallocate(alloc_, this, 1u);
108
+ std::move(h)(std::forward<Ts>(ts)...);
109
+ }
110
+
111
+ template<typename Alloc_, typename Handler_>
112
+ completion_impl(Alloc_&& alloc, Handler_&& wh)
113
+ : handler(std::forward<Handler_>(wh)),
114
+ allocator(std::forward<Alloc_>(alloc))
115
+ {
116
+ }
117
+ };
118
+
119
+ completion_base* completion = nullptr;
120
+ typename boost::asio::aligned_storage<sizeof(void*) * 4,
121
+ alignof(completion_base)>::type completion_opt;
122
+
123
+ template<typename Alloc, typename Handler>
124
+ void set_completion(Alloc&& alloc, Handler&& handler)
125
+ {
126
+ if (completion)
127
+ cancel_();
128
+
129
+ using impl_t = completion_impl<
130
+ typename boost::asio::decay<Alloc>::type, Handler>;
131
+ using alloc_t = typename std::allocator_traits<
132
+ typename boost::asio::decay<Alloc>::type>::template rebind_alloc<impl_t>;
133
+
134
+ alloc_t alloc_{alloc};
135
+ auto p = std::allocator_traits<alloc_t>::allocate(alloc_, 1u);
136
+ completion = new (p) impl_t(std::forward<Alloc>(alloc),
137
+ std::forward<Handler>(handler));
138
+ }
139
+
140
+ template<typename... T_>
141
+ void complete(T_&&... ts)
142
+ {
143
+ assert(completion);
144
+ std::exchange(completion, nullptr)->invoke(std::forward<T_>(ts)...);
145
+ }
56
146
 
57
- template<typename Signature, typename Executor>
147
+ template<typename... T_>
148
+ void cancel_impl_(std::exception_ptr*, T_*...)
149
+ {
150
+ complete(
151
+ std::make_exception_ptr(
152
+ boost::system::system_error(
153
+ boost::asio::error::operation_aborted)),
154
+ T_{}...);
155
+ }
156
+
157
+ template<typename... T_>
158
+ void cancel_impl_(boost::system::error_code*, T_*...)
159
+ {
160
+ complete(boost::asio::error::operation_aborted, T_{}...);
161
+ }
162
+
163
+ template<typename... T_>
164
+ void cancel_impl_(T_*...)
165
+ {
166
+ complete(T_{}...);
167
+ }
168
+
169
+ void cancel_()
170
+ {
171
+ cancel_impl_(static_cast<Ts*>(nullptr)...);
172
+ }
173
+ };
174
+
175
+ template<typename Signature = void(),
176
+ typename Executor = boost::asio::any_io_executor,
177
+ typename Allocator = any_io_executor>
58
178
  struct promise_handler;
59
179
 
60
- template<typename ... Ts, typename Executor>
61
- struct promise_handler<void(Ts...), Executor>
180
+ template<typename... Ts, typename Executor, typename Allocator>
181
+ struct promise_handler<void(Ts...), Executor, Allocator>
62
182
  {
63
- using promise_type = promise<void(Ts...), Executor>;
183
+ using promise_type = promise<void(Ts...), Executor, Allocator>;
64
184
 
65
- promise_handler(Executor executor) // get_associated_allocator(exec)
66
- : impl_{
67
- std::allocate_shared<promise_impl<void(Ts...), Executor>>(
68
- get_associated_allocator(executor))}
185
+ promise_handler(
186
+ Allocator allocator, Executor executor) // get_associated_allocator(exec)
187
+ : impl_(
188
+ std::allocate_shared<promise_impl<void(Ts...), Executor, Allocator>>(
189
+ allocator, allocator, executor))
69
190
  {
70
- impl_->executor = std::move(executor);
71
191
  }
72
192
 
73
- std::shared_ptr<promise_impl<void(Ts...), Executor>> impl_;
193
+ std::shared_ptr<promise_impl<void(Ts...), Executor, Allocator>> impl_;
74
194
 
75
195
  using cancellation_slot_type = cancellation_slot;
76
196
 
@@ -79,18 +199,37 @@ struct promise_handler<void(Ts...), Executor>
79
199
  return impl_->cancel.slot();
80
200
  }
81
201
 
82
- auto make_promise() -> promise<void(Ts...), Executor>
202
+ using allocator_type = Allocator;
203
+
204
+ allocator_type get_allocator() const noexcept
205
+ {
206
+ return impl_->get_allocator();
207
+ }
208
+
209
+ using executor_type = Executor;
210
+
211
+ Executor get_executor() const noexcept
83
212
  {
84
- return {impl_};
213
+ return impl_->get_executor();
214
+ }
215
+
216
+ auto make_promise() -> promise<void(Ts...), executor_type, allocator_type>
217
+ {
218
+ return promise<void(Ts...), executor_type, allocator_type>{impl_};
85
219
  }
86
220
 
87
221
  void operator()(std::remove_reference_t<Ts>... ts)
88
222
  {
89
223
  assert(impl_);
90
- impl_->result.emplace(std::move(ts)...);
224
+
225
+ using result_type = typename promise_impl<
226
+ void(Ts...), allocator_type, executor_type>::result_type ;
227
+
228
+ new (&impl_->result) result_type(std::move(ts)...);
91
229
  impl_->done = true;
92
- if (auto f = std::exchange(impl_->completion, nullptr); f != nullptr)
93
- std::apply(std::move(f), std::move(*impl_->result));
230
+
231
+ if (impl_->completion)
232
+ impl_->complete(std::move(ts)...);
94
233
  }
95
234
  };
96
235