Handler.qbk 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. [/
  2. / Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  3. /
  4. / Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. /]
  7. [section:Handler Handlers]
  8. A handler must meet the requirements of `MoveConstructible` types (C++Std
  9. [moveconstructible]).
  10. In the table below, `X` denotes a handler class, `h` denotes a value of `X`,
  11. `p` denotes a pointer to a block of allocated memory of type `void*`, `s`
  12. denotes the size for a block of allocated memory, and `f` denotes a function
  13. object taking no arguments.
  14. [table Handler requirements
  15. [[expression] [return type] [assertion/note\npre/post-conditions]]
  16. [
  17. [``
  18. using boost::asio::asio_handler_allocate;
  19. asio_handler_allocate(s, &h);
  20. ``]
  21. [`void*`]
  22. [
  23. Returns a pointer to a block of memory of size `s`. The pointer must
  24. satisfy the same alignment requirements as a pointer returned by
  25. `::operator new()`. Throws `bad_alloc` on failure.\n\n The
  26. `asio_handler_allocate()` function is located using argument-dependent
  27. lookup. The function `boost::asio::asio_handler_allocate()` serves as a
  28. default if no user-supplied function is available.
  29. ]
  30. ]
  31. [
  32. [``
  33. using boost::asio::asio_handler_deallocate;
  34. asio_handler_deallocate(p, s, &h);
  35. ``]
  36. []
  37. [
  38. Frees a block of memory associated with a pointer `p`, of at least size
  39. `s`, that was previously allocated using `asio_handler_allocate()`.\n\n The
  40. `asio_handler_deallocate()` function is located using argument-dependent
  41. lookup. The function `boost::asio::asio_handler_deallocate()` serves as a
  42. default if no user-supplied function is available.
  43. ]
  44. ]
  45. [
  46. [``
  47. using boost::asio::asio_handler_invoke;
  48. asio_handler_invoke(f, &h);
  49. ``]
  50. []
  51. [
  52. Causes the function object `f` to be executed as if by calling `f()`.\n\n
  53. The `asio_handler_invoke()` function is located using argument-dependent
  54. lookup. The function `boost::asio::asio_handler_invoke()` serves as a
  55. default if no user-supplied function is available.
  56. ]
  57. ]
  58. ]
  59. [endsect]