summaryrefslogtreecommitdiff
path: root/boost/asio/detail/handler_tracking.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:11:01 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2019-12-05 15:11:01 +0900
commit3fdc3e5ee96dca5b11d1694975a65200787eab86 (patch)
tree5c1733853892b8397d67706fa453a9bd978d2102 /boost/asio/detail/handler_tracking.hpp
parent88e602c57797660ebe0f9e15dbd64c1ff16dead3 (diff)
downloadboost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.gz
boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.bz2
boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.zip
Imported Upstream version 1.66.0upstream/1.66.0
Diffstat (limited to 'boost/asio/detail/handler_tracking.hpp')
-rw-r--r--boost/asio/detail/handler_tracking.hpp97
1 files changed, 89 insertions, 8 deletions
diff --git a/boost/asio/detail/handler_tracking.hpp b/boost/asio/detail/handler_tracking.hpp
index fd69bdd5b6..92e8a469f1 100644
--- a/boost/asio/detail/handler_tracking.hpp
+++ b/boost/asio/detail/handler_tracking.hpp
@@ -17,7 +17,17 @@
#include <boost/asio/detail/config.hpp>
-#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+namespace boost {
+namespace asio {
+
+class execution_context;
+
+} // namespace asio
+} // namespace boost
+
+#if defined(BOOST_ASIO_CUSTOM_HANDLER_TRACKING)
+# include BOOST_ASIO_CUSTOM_HANDLER_TRACKING
+#elif defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
# include <boost/system/error_code.hpp>
# include <boost/asio/detail/cstdint.hpp>
# include <boost/asio/detail/static_mutex.hpp>
@@ -30,7 +40,30 @@ namespace boost {
namespace asio {
namespace detail {
-#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+#if defined(BOOST_ASIO_CUSTOM_HANDLER_TRACKING)
+
+// The user-specified header must define the following macros:
+// - BOOST_ASIO_INHERIT_TRACKED_HANDLER
+// - BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER
+// - BOOST_ASIO_HANDLER_TRACKING_INIT
+// - BOOST_ASIO_HANDLER_CREATION(args)
+// - BOOST_ASIO_HANDLER_COMPLETION(args)
+// - BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args)
+// - BOOST_ASIO_HANDLER_INVOCATION_END
+// - BOOST_ASIO_HANDLER_OPERATION(args)
+// - BOOST_ASIO_HANDLER_REACTOR_REGISTRATION(args)
+// - BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION(args)
+// - BOOST_ASIO_HANDLER_REACTOR_READ_EVENT
+// - BOOST_ASIO_HANDLER_REACTOR_WRITE_EVENT
+// - BOOST_ASIO_HANDLER_REACTOR_ERROR_EVENT
+// - BOOST_ASIO_HANDLER_REACTOR_EVENTS(args)
+// - BOOST_ASIO_HANDLER_REACTOR_OPERATION(args)
+
+# if !defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+# define BOOST_ASIO_ENABLE_HANDLER_TRACKING 1
+# endif /// !defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
+
+#elif defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
class handler_tracking
{
@@ -58,14 +91,16 @@ public:
BOOST_ASIO_DECL static void init();
// Record the creation of a tracked handler.
- BOOST_ASIO_DECL static void creation(tracked_handler* h,
- const char* object_type, void* object, const char* op_name);
+ BOOST_ASIO_DECL static void creation(
+ execution_context& context, tracked_handler& h,
+ const char* object_type, void* object,
+ uintmax_t native_handle, const char* op_name);
class completion
{
public:
// Constructor records that handler is to be invoked with no arguments.
- BOOST_ASIO_DECL explicit completion(tracked_handler* h);
+ BOOST_ASIO_DECL explicit completion(const tracked_handler& h);
// Destructor records only when an exception is thrown from the handler, or
// if the memory is being freed without the handler having been invoked.
@@ -99,9 +134,32 @@ public:
completion* next_;
};
- // Record an operation that affects pending handlers.
- BOOST_ASIO_DECL static void operation(const char* object_type,
- void* object, const char* op_name);
+ // Record an operation that is not directly associated with a handler.
+ BOOST_ASIO_DECL static void operation(execution_context& context,
+ const char* object_type, void* object,
+ uintmax_t native_handle, const char* op_name);
+
+ // Record that a descriptor has been registered with the reactor.
+ BOOST_ASIO_DECL static void reactor_registration(execution_context& context,
+ uintmax_t native_handle, uintmax_t registration);
+
+ // Record that a descriptor has been deregistered from the reactor.
+ BOOST_ASIO_DECL static void reactor_deregistration(execution_context& context,
+ uintmax_t native_handle, uintmax_t registration);
+
+ // Record a reactor-based operation that is associated with a handler.
+ BOOST_ASIO_DECL static void reactor_events(execution_context& context,
+ uintmax_t registration, unsigned events);
+
+ // Record a reactor-based operation that is associated with a handler.
+ BOOST_ASIO_DECL static void reactor_operation(
+ const tracked_handler& h, const char* op_name,
+ const boost::system::error_code& ec);
+
+ // Record a reactor-based operation that is associated with a handler.
+ BOOST_ASIO_DECL static void reactor_operation(
+ const tracked_handler& h, const char* op_name,
+ const boost::system::error_code& ec, std::size_t bytes_transferred);
// Write a line of output.
BOOST_ASIO_DECL static void write_line(const char* format, ...);
@@ -135,6 +193,22 @@ private:
# define BOOST_ASIO_HANDLER_OPERATION(args) \
boost::asio::detail::handler_tracking::operation args
+# define BOOST_ASIO_HANDLER_REACTOR_REGISTRATION(args) \
+ boost::asio::detail::handler_tracking::reactor_registration args
+
+# define BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION(args) \
+ boost::asio::detail::handler_tracking::reactor_deregistration args
+
+# define BOOST_ASIO_HANDLER_REACTOR_READ_EVENT 1
+# define BOOST_ASIO_HANDLER_REACTOR_WRITE_EVENT 2
+# define BOOST_ASIO_HANDLER_REACTOR_ERROR_EVENT 4
+
+# define BOOST_ASIO_HANDLER_REACTOR_EVENTS(args) \
+ boost::asio::detail::handler_tracking::reactor_events args
+
+# define BOOST_ASIO_HANDLER_REACTOR_OPERATION(args) \
+ boost::asio::detail::handler_tracking::reactor_operation args
+
#else // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)
# define BOOST_ASIO_INHERIT_TRACKED_HANDLER
@@ -145,6 +219,13 @@ private:
# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) (void)0
# define BOOST_ASIO_HANDLER_INVOCATION_END (void)0
# define BOOST_ASIO_HANDLER_OPERATION(args) (void)0
+# define BOOST_ASIO_HANDLER_REACTOR_REGISTRATION(args) (void)0
+# define BOOST_ASIO_HANDLER_REACTOR_DEREGISTRATION(args) (void)0
+# define BOOST_ASIO_HANDLER_REACTOR_READ_EVENT 0
+# define BOOST_ASIO_HANDLER_REACTOR_WRITE_EVENT 0
+# define BOOST_ASIO_HANDLER_REACTOR_ERROR_EVENT 0
+# define BOOST_ASIO_HANDLER_REACTOR_EVENTS(args) (void)0
+# define BOOST_ASIO_HANDLER_REACTOR_OPERATION(args) (void)0
#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING)