kqueue_reactor.ipp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. //
  2. // detail/impl/kqueue_reactor.ipp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  9. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. #ifndef BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_IPP
  12. #define BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_IPP
  13. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  14. # pragma once
  15. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  16. #include <boost/asio/detail/config.hpp>
  17. #if defined(BOOST_ASIO_HAS_KQUEUE)
  18. #include <boost/asio/detail/kqueue_reactor.hpp>
  19. #include <boost/asio/detail/scheduler.hpp>
  20. #include <boost/asio/detail/throw_error.hpp>
  21. #include <boost/asio/error.hpp>
  22. #if defined(__NetBSD__)
  23. # include <sys/param.h>
  24. #endif
  25. #include <boost/asio/detail/push_options.hpp>
  26. #if defined(__NetBSD__) && __NetBSD_Version__ < 999001500
  27. # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \
  28. EV_SET(ev, ident, filt, flags, fflags, data, \
  29. reinterpret_cast<intptr_t>(static_cast<void*>(udata)))
  30. #else
  31. # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \
  32. EV_SET(ev, ident, filt, flags, fflags, data, udata)
  33. #endif
  34. namespace boost {
  35. namespace asio {
  36. namespace detail {
  37. kqueue_reactor::kqueue_reactor(boost::asio::execution_context& ctx)
  38. : execution_context_service_base<kqueue_reactor>(ctx),
  39. scheduler_(use_service<scheduler>(ctx)),
  40. mutex_(BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(
  41. REACTOR_REGISTRATION, scheduler_.concurrency_hint())),
  42. kqueue_fd_(do_kqueue_create()),
  43. interrupter_(),
  44. shutdown_(false),
  45. registered_descriptors_mutex_(mutex_.enabled())
  46. {
  47. struct kevent events[1];
  48. BOOST_ASIO_KQUEUE_EV_SET(&events[0], interrupter_.read_descriptor(),
  49. EVFILT_READ, EV_ADD, 0, 0, &interrupter_);
  50. if (::kevent(kqueue_fd_, events, 1, 0, 0, 0) == -1)
  51. {
  52. boost::system::error_code error(errno,
  53. boost::asio::error::get_system_category());
  54. boost::asio::detail::throw_error(error);
  55. }
  56. }
  57. kqueue_reactor::~kqueue_reactor()
  58. {
  59. close(kqueue_fd_);
  60. }
  61. void kqueue_reactor::shutdown()
  62. {
  63. mutex::scoped_lock lock(mutex_);
  64. shutdown_ = true;
  65. lock.unlock();
  66. op_queue<operation> ops;
  67. while (descriptor_state* state = registered_descriptors_.first())
  68. {
  69. for (int i = 0; i < max_ops; ++i)
  70. ops.push(state->op_queue_[i]);
  71. state->shutdown_ = true;
  72. registered_descriptors_.free(state);
  73. }
  74. timer_queues_.get_all_timers(ops);
  75. scheduler_.abandon_operations(ops);
  76. }
  77. void kqueue_reactor::notify_fork(
  78. boost::asio::execution_context::fork_event fork_ev)
  79. {
  80. if (fork_ev == boost::asio::execution_context::fork_child)
  81. {
  82. // The kqueue descriptor is automatically closed in the child.
  83. kqueue_fd_ = -1;
  84. kqueue_fd_ = do_kqueue_create();
  85. interrupter_.recreate();
  86. struct kevent events[2];
  87. BOOST_ASIO_KQUEUE_EV_SET(&events[0], interrupter_.read_descriptor(),
  88. EVFILT_READ, EV_ADD, 0, 0, &interrupter_);
  89. if (::kevent(kqueue_fd_, events, 1, 0, 0, 0) == -1)
  90. {
  91. boost::system::error_code ec(errno,
  92. boost::asio::error::get_system_category());
  93. boost::asio::detail::throw_error(ec, "kqueue interrupter registration");
  94. }
  95. // Re-register all descriptors with kqueue.
  96. mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
  97. for (descriptor_state* state = registered_descriptors_.first();
  98. state != 0; state = state->next_)
  99. {
  100. if (state->num_kevents_ > 0)
  101. {
  102. BOOST_ASIO_KQUEUE_EV_SET(&events[0], state->descriptor_,
  103. EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, state);
  104. BOOST_ASIO_KQUEUE_EV_SET(&events[1], state->descriptor_,
  105. EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, state);
  106. if (::kevent(kqueue_fd_, events, state->num_kevents_, 0, 0, 0) == -1)
  107. {
  108. boost::system::error_code ec(errno,
  109. boost::asio::error::get_system_category());
  110. boost::asio::detail::throw_error(ec, "kqueue re-registration");
  111. }
  112. }
  113. }
  114. }
  115. }
  116. void kqueue_reactor::init_task()
  117. {
  118. scheduler_.init_task();
  119. }
  120. int kqueue_reactor::register_descriptor(socket_type descriptor,
  121. kqueue_reactor::per_descriptor_data& descriptor_data)
  122. {
  123. descriptor_data = allocate_descriptor_state();
  124. BOOST_ASIO_HANDLER_REACTOR_REGISTRATION((
  125. context(), static_cast<uintmax_t>(descriptor),
  126. reinterpret_cast<uintmax_t>(descriptor_data)));
  127. mutex::scoped_lock lock(descriptor_data->mutex_);
  128. descriptor_data->descriptor_ = descriptor;
  129. descriptor_data->num_kevents_ = 0;
  130. descriptor_data->shutdown_ = false;
  131. return 0;
  132. }
  133. int kqueue_reactor::register_internal_descriptor(
  134. int op_type, socket_type descriptor,
  135. kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op)
  136. {
  137. descriptor_data = allocate_descriptor_state();
  138. BOOST_ASIO_HANDLER_REACTOR_REGISTRATION((
  139. context(), static_cast<uintmax_t>(descriptor),
  140. reinterpret_cast<uintmax_t>(descriptor_data)));
  141. mutex::scoped_lock lock(descriptor_data->mutex_);
  142. descriptor_data->descriptor_ = descriptor;
  143. descriptor_data->num_kevents_ = 1;
  144. descriptor_data->shutdown_ = false;
  145. descriptor_data->op_queue_[op_type].push(op);
  146. struct kevent events[1];
  147. BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, EVFILT_READ,
  148. EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
  149. if (::kevent(kqueue_fd_, events, 1, 0, 0, 0) == -1)
  150. return errno;
  151. return 0;
  152. }
  153. void kqueue_reactor::move_descriptor(socket_type,
  154. kqueue_reactor::per_descriptor_data& target_descriptor_data,
  155. kqueue_reactor::per_descriptor_data& source_descriptor_data)
  156. {
  157. target_descriptor_data = source_descriptor_data;
  158. source_descriptor_data = 0;
  159. }
  160. void kqueue_reactor::call_post_immediate_completion(
  161. operation* op, bool is_continuation, const void* self)
  162. {
  163. static_cast<const kqueue_reactor*>(self)->post_immediate_completion(
  164. op, is_continuation);
  165. }
  166. void kqueue_reactor::start_op(int op_type, socket_type descriptor,
  167. kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op,
  168. bool is_continuation, bool allow_speculative,
  169. void (*on_immediate)(operation*, bool, const void*),
  170. const void* immediate_arg)
  171. {
  172. if (!descriptor_data)
  173. {
  174. op->ec_ = boost::asio::error::bad_descriptor;
  175. on_immediate(op, is_continuation, immediate_arg);
  176. return;
  177. }
  178. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  179. if (descriptor_data->shutdown_)
  180. {
  181. on_immediate(op, is_continuation, immediate_arg);
  182. return;
  183. }
  184. if (descriptor_data->op_queue_[op_type].empty())
  185. {
  186. static const int num_kevents[max_ops] = { 1, 2, 1 };
  187. if (allow_speculative
  188. && (op_type != read_op
  189. || descriptor_data->op_queue_[except_op].empty()))
  190. {
  191. if (op->perform())
  192. {
  193. descriptor_lock.unlock();
  194. on_immediate(op, is_continuation, immediate_arg);
  195. return;
  196. }
  197. if (descriptor_data->num_kevents_ < num_kevents[op_type])
  198. {
  199. struct kevent events[2];
  200. BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, EVFILT_READ,
  201. EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
  202. BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, EVFILT_WRITE,
  203. EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
  204. if (::kevent(kqueue_fd_, events, num_kevents[op_type], 0, 0, 0) != -1)
  205. {
  206. descriptor_data->num_kevents_ = num_kevents[op_type];
  207. }
  208. else
  209. {
  210. op->ec_ = boost::system::error_code(errno,
  211. boost::asio::error::get_system_category());
  212. on_immediate(op, is_continuation, immediate_arg);
  213. return;
  214. }
  215. }
  216. }
  217. else
  218. {
  219. if (descriptor_data->num_kevents_ < num_kevents[op_type])
  220. descriptor_data->num_kevents_ = num_kevents[op_type];
  221. struct kevent events[2];
  222. BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, EVFILT_READ,
  223. EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
  224. BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, EVFILT_WRITE,
  225. EV_ADD | EV_CLEAR, 0, 0, descriptor_data);
  226. ::kevent(kqueue_fd_, events, descriptor_data->num_kevents_, 0, 0, 0);
  227. }
  228. }
  229. descriptor_data->op_queue_[op_type].push(op);
  230. scheduler_.work_started();
  231. }
  232. void kqueue_reactor::cancel_ops(socket_type,
  233. kqueue_reactor::per_descriptor_data& descriptor_data)
  234. {
  235. if (!descriptor_data)
  236. return;
  237. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  238. op_queue<operation> ops;
  239. for (int i = 0; i < max_ops; ++i)
  240. {
  241. while (reactor_op* op = descriptor_data->op_queue_[i].front())
  242. {
  243. op->ec_ = boost::asio::error::operation_aborted;
  244. descriptor_data->op_queue_[i].pop();
  245. ops.push(op);
  246. }
  247. }
  248. descriptor_lock.unlock();
  249. scheduler_.post_deferred_completions(ops);
  250. }
  251. void kqueue_reactor::cancel_ops_by_key(socket_type,
  252. kqueue_reactor::per_descriptor_data& descriptor_data,
  253. int op_type, void* cancellation_key)
  254. {
  255. if (!descriptor_data)
  256. return;
  257. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  258. op_queue<operation> ops;
  259. op_queue<reactor_op> other_ops;
  260. while (reactor_op* op = descriptor_data->op_queue_[op_type].front())
  261. {
  262. descriptor_data->op_queue_[op_type].pop();
  263. if (op->cancellation_key_ == cancellation_key)
  264. {
  265. op->ec_ = boost::asio::error::operation_aborted;
  266. ops.push(op);
  267. }
  268. else
  269. other_ops.push(op);
  270. }
  271. descriptor_data->op_queue_[op_type].push(other_ops);
  272. descriptor_lock.unlock();
  273. scheduler_.post_deferred_completions(ops);
  274. }
  275. void kqueue_reactor::deregister_descriptor(socket_type descriptor,
  276. kqueue_reactor::per_descriptor_data& descriptor_data, bool closing)
  277. {
  278. if (!descriptor_data)
  279. return;
  280. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  281. if (!descriptor_data->shutdown_)
  282. {
  283. if (closing)
  284. {
  285. // The descriptor will be automatically removed from the kqueue when it
  286. // is closed.
  287. }
  288. else
  289. {
  290. struct kevent events[2];
  291. BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor,
  292. EVFILT_READ, EV_DELETE, 0, 0, 0);
  293. BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor,
  294. EVFILT_WRITE, EV_DELETE, 0, 0, 0);
  295. ::kevent(kqueue_fd_, events, descriptor_data->num_kevents_, 0, 0, 0);
  296. }
  297. op_queue<operation> ops;
  298. for (int i = 0; i < max_ops; ++i)
  299. {
  300. while (reactor_op* op = descriptor_data->op_queue_[i].front())
  301. {
  302. op->ec_ = boost::asio::error::operation_aborted;
  303. descriptor_data->op_queue_[i].pop();
  304. ops.push(op);
  305. }
  306. }
  307. descriptor_data->descriptor_ = -1;
  308. descriptor_data->shutdown_ = true;
  309. descriptor_lock.unlock();
  310. BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION((
  311. context(), static_cast<uintmax_t>(descriptor),
  312. reinterpret_cast<uintmax_t>(descriptor_data)));
  313. scheduler_.post_deferred_completions(ops);
  314. // Leave descriptor_data set so that it will be freed by the subsequent
  315. // call to cleanup_descriptor_data.
  316. }
  317. else
  318. {
  319. // We are shutting down, so prevent cleanup_descriptor_data from freeing
  320. // the descriptor_data object and let the destructor free it instead.
  321. descriptor_data = 0;
  322. }
  323. }
  324. void kqueue_reactor::deregister_internal_descriptor(socket_type descriptor,
  325. kqueue_reactor::per_descriptor_data& descriptor_data)
  326. {
  327. if (!descriptor_data)
  328. return;
  329. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  330. if (!descriptor_data->shutdown_)
  331. {
  332. struct kevent events[2];
  333. BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor,
  334. EVFILT_READ, EV_DELETE, 0, 0, 0);
  335. BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor,
  336. EVFILT_WRITE, EV_DELETE, 0, 0, 0);
  337. ::kevent(kqueue_fd_, events, descriptor_data->num_kevents_, 0, 0, 0);
  338. op_queue<operation> ops;
  339. for (int i = 0; i < max_ops; ++i)
  340. ops.push(descriptor_data->op_queue_[i]);
  341. descriptor_data->descriptor_ = -1;
  342. descriptor_data->shutdown_ = true;
  343. descriptor_lock.unlock();
  344. BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION((
  345. context(), static_cast<uintmax_t>(descriptor),
  346. reinterpret_cast<uintmax_t>(descriptor_data)));
  347. // Leave descriptor_data set so that it will be freed by the subsequent
  348. // call to cleanup_descriptor_data.
  349. }
  350. else
  351. {
  352. // We are shutting down, so prevent cleanup_descriptor_data from freeing
  353. // the descriptor_data object and let the destructor free it instead.
  354. descriptor_data = 0;
  355. }
  356. }
  357. void kqueue_reactor::cleanup_descriptor_data(
  358. per_descriptor_data& descriptor_data)
  359. {
  360. if (descriptor_data)
  361. {
  362. free_descriptor_state(descriptor_data);
  363. descriptor_data = 0;
  364. }
  365. }
  366. void kqueue_reactor::run(long usec, op_queue<operation>& ops)
  367. {
  368. mutex::scoped_lock lock(mutex_);
  369. // Determine how long to block while waiting for events.
  370. timespec timeout_buf = { 0, 0 };
  371. timespec* timeout = usec ? get_timeout(usec, timeout_buf) : &timeout_buf;
  372. lock.unlock();
  373. // Block on the kqueue descriptor.
  374. struct kevent events[128];
  375. int num_events = kevent(kqueue_fd_, 0, 0, events, 128, timeout);
  376. #if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
  377. // Trace the waiting events.
  378. for (int i = 0; i < num_events; ++i)
  379. {
  380. void* ptr = reinterpret_cast<void*>(events[i].udata);
  381. if (ptr != &interrupter_)
  382. {
  383. unsigned event_mask = 0;
  384. switch (events[i].filter)
  385. {
  386. case EVFILT_READ:
  387. event_mask |= BOOST_ASIO_HANDLER_REACTOR_READ_EVENT;
  388. break;
  389. case EVFILT_WRITE:
  390. event_mask |= BOOST_ASIO_HANDLER_REACTOR_WRITE_EVENT;
  391. break;
  392. }
  393. if ((events[i].flags & (EV_ERROR | EV_OOBAND)) != 0)
  394. event_mask |= BOOST_ASIO_HANDLER_REACTOR_ERROR_EVENT;
  395. BOOST_ASIO_HANDLER_REACTOR_EVENTS((context(),
  396. reinterpret_cast<uintmax_t>(ptr), event_mask));
  397. }
  398. }
  399. #endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
  400. // Dispatch the waiting events.
  401. for (int i = 0; i < num_events; ++i)
  402. {
  403. void* ptr = reinterpret_cast<void*>(events[i].udata);
  404. if (ptr == &interrupter_)
  405. {
  406. interrupter_.reset();
  407. }
  408. else
  409. {
  410. descriptor_state* descriptor_data = static_cast<descriptor_state*>(ptr);
  411. mutex::scoped_lock descriptor_lock(descriptor_data->mutex_);
  412. if (events[i].filter == EVFILT_WRITE
  413. && descriptor_data->num_kevents_ == 2
  414. && descriptor_data->op_queue_[write_op].empty())
  415. {
  416. // Some descriptor types, like serial ports, don't seem to support
  417. // EV_CLEAR with EVFILT_WRITE. Since we have no pending write
  418. // operations we'll remove the EVFILT_WRITE registration here so that
  419. // we don't end up in a tight spin.
  420. struct kevent delete_events[1];
  421. BOOST_ASIO_KQUEUE_EV_SET(&delete_events[0],
  422. descriptor_data->descriptor_, EVFILT_WRITE, EV_DELETE, 0, 0, 0);
  423. ::kevent(kqueue_fd_, delete_events, 1, 0, 0, 0);
  424. descriptor_data->num_kevents_ = 1;
  425. }
  426. // Exception operations must be processed first to ensure that any
  427. // out-of-band data is read before normal data.
  428. #if defined(__NetBSD__)
  429. static const unsigned int filter[max_ops] =
  430. #else
  431. static const int filter[max_ops] =
  432. #endif
  433. { EVFILT_READ, EVFILT_WRITE, EVFILT_READ };
  434. for (int j = max_ops - 1; j >= 0; --j)
  435. {
  436. if (events[i].filter == filter[j])
  437. {
  438. if (j != except_op || events[i].flags & EV_OOBAND)
  439. {
  440. while (reactor_op* op = descriptor_data->op_queue_[j].front())
  441. {
  442. if (events[i].flags & EV_ERROR)
  443. {
  444. op->ec_ = boost::system::error_code(
  445. static_cast<int>(events[i].data),
  446. boost::asio::error::get_system_category());
  447. descriptor_data->op_queue_[j].pop();
  448. ops.push(op);
  449. }
  450. if (op->perform())
  451. {
  452. descriptor_data->op_queue_[j].pop();
  453. ops.push(op);
  454. }
  455. else
  456. break;
  457. }
  458. }
  459. }
  460. }
  461. }
  462. }
  463. lock.lock();
  464. timer_queues_.get_ready_timers(ops);
  465. }
  466. void kqueue_reactor::interrupt()
  467. {
  468. interrupter_.interrupt();
  469. }
  470. int kqueue_reactor::do_kqueue_create()
  471. {
  472. int fd = ::kqueue();
  473. if (fd == -1)
  474. {
  475. boost::system::error_code ec(errno,
  476. boost::asio::error::get_system_category());
  477. boost::asio::detail::throw_error(ec, "kqueue");
  478. }
  479. return fd;
  480. }
  481. kqueue_reactor::descriptor_state* kqueue_reactor::allocate_descriptor_state()
  482. {
  483. mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
  484. return registered_descriptors_.alloc(BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(
  485. REACTOR_IO, scheduler_.concurrency_hint()));
  486. }
  487. void kqueue_reactor::free_descriptor_state(kqueue_reactor::descriptor_state* s)
  488. {
  489. mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_);
  490. registered_descriptors_.free(s);
  491. }
  492. void kqueue_reactor::do_add_timer_queue(timer_queue_base& queue)
  493. {
  494. mutex::scoped_lock lock(mutex_);
  495. timer_queues_.insert(&queue);
  496. }
  497. void kqueue_reactor::do_remove_timer_queue(timer_queue_base& queue)
  498. {
  499. mutex::scoped_lock lock(mutex_);
  500. timer_queues_.erase(&queue);
  501. }
  502. timespec* kqueue_reactor::get_timeout(long usec, timespec& ts)
  503. {
  504. // By default we will wait no longer than 5 minutes. This will ensure that
  505. // any changes to the system clock are detected after no longer than this.
  506. const long max_usec = 5 * 60 * 1000 * 1000;
  507. usec = timer_queues_.wait_duration_usec(
  508. (usec < 0 || max_usec < usec) ? max_usec : usec);
  509. ts.tv_sec = usec / 1000000;
  510. ts.tv_nsec = (usec % 1000000) * 1000;
  511. return &ts;
  512. }
  513. } // namespace detail
  514. } // namespace asio
  515. } // namespace boost
  516. #undef BOOST_ASIO_KQUEUE_EV_SET
  517. #include <boost/asio/detail/pop_options.hpp>
  518. #endif // defined(BOOST_ASIO_HAS_KQUEUE)
  519. #endif // BOOST_ASIO_DETAIL_IMPL_KQUEUE_REACTOR_IPP