MCPcopy Create free account
hub / github.com/boostorg/asio / creation

Method creation

example/cpp11/handler_tracking/custom_tracking.hpp:85–105  ·  view source on GitHub ↗

Record the creation of a tracked handler.

Source from the content-addressed store, hash-verified

83
84 // Record the creation of a tracked handler.
85 static void creation(boost::asio::execution_context& /*ctx*/,
86 tracked_handler& h, const char* object_type, void* /*object*/,
87 std::uintmax_t native_handle, const char* op_name)
88 {
89 // Generate a unique id for the new handler.
90 static std::atomic<std::uintmax_t> next_handler_id{1};
91 h.handler_id_ = next_handler_id++;
92
93 // Copy the tree identifier forward from the current handler.
94 if (*current_completion())
95 h.tree_id_ = (*current_completion())->handler_.tree_id_;
96
97 // Store various attributes of the operation to use in later output.
98 h.object_type_ = object_type;
99 h.native_handle_ = native_handle;
100
101 std::printf(
102 "Starting operation %s.%s for native_handle = %" PRIuMAX
103 ", handler = %" PRIuMAX ", tree = %" PRIuMAX "\n",
104 object_type, op_name, h.native_handle_, h.handler_id_, h.tree_id_);
105 }
106
107 struct completion
108 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected