Pass native handle (e.g. descriptor) to handler tracking.
diff --git a/asio/include/asio/detail/cstdint.hpp b/asio/include/asio/detail/cstdint.hpp
index e3ee84c..8d5ad57 100644
--- a/asio/include/asio/detail/cstdint.hpp
+++ b/asio/include/asio/detail/cstdint.hpp
@@ -32,6 +32,7 @@
 using std::uint32_t;
 using std::int64_t;
 using std::uint64_t;
+using std::uintmax_t;
 #else // defined(ASIO_HAS_CSTDINT)
 using boost::int16_t;
 using boost::uint16_t;
@@ -39,6 +40,7 @@
 using boost::uint32_t;
 using boost::int64_t;
 using boost::uint64_t;
+using boost::uintmax_t;
 #endif // defined(ASIO_HAS_CSTDINT)
 
 } // namespace asio
diff --git a/asio/include/asio/detail/deadline_timer_service.hpp b/asio/include/asio/detail/deadline_timer_service.hpp
index 3c54f67..f6f17d5 100644
--- a/asio/include/asio/detail/deadline_timer_service.hpp
+++ b/asio/include/asio/detail/deadline_timer_service.hpp
@@ -135,7 +135,7 @@
     }
 
     ASIO_HANDLER_OPERATION((scheduler_.context(),
-          "deadline_timer", &impl, "cancel"));
+          "deadline_timer", &impl, 0, "cancel"));
 
     std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data);
     impl.might_have_pending_waits = false;
@@ -154,7 +154,7 @@
     }
 
     ASIO_HANDLER_OPERATION((scheduler_.context(),
-          "deadline_timer", &impl, "cancel_one"));
+          "deadline_timer", &impl, 0, "cancel_one"));
 
     std::size_t count = scheduler_.cancel_timer(
         timer_queue_, impl.timer_data, 1);
@@ -214,7 +214,7 @@
     impl.might_have_pending_waits = true;
 
     ASIO_HANDLER_CREATION((scheduler_.context(),
-          *p.p, "deadline_timer", &impl, "async_wait"));
+          *p.p, "deadline_timer", &impl, 0, "async_wait"));
 
     scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/handler_tracking.hpp b/asio/include/asio/detail/handler_tracking.hpp
index dbb51a9..67533a5 100644
--- a/asio/include/asio/detail/handler_tracking.hpp
+++ b/asio/include/asio/detail/handler_tracking.hpp
@@ -75,7 +75,8 @@
   // Record the creation of a tracked handler.
   ASIO_DECL static void creation(
       execution_context& context, tracked_handler& h,
-      const char* object_type, void* object, const char* op_name);
+      const char* object_type, void* object,
+      uintmax_t native_handle, const char* op_name);
 
   class completion
   {
@@ -117,7 +118,8 @@
 
   // Record an operation that affects pending handlers.
   ASIO_DECL static void operation(execution_context& context,
-      const char* object_type, void* object, const char* op_name);
+      const char* object_type, void* object,
+      uintmax_t native_handle, const char* op_name);
 
   // Write a line of output.
   ASIO_DECL static void write_line(const char* format, ...);
diff --git a/asio/include/asio/detail/impl/handler_tracking.ipp b/asio/include/asio/detail/impl/handler_tracking.ipp
index 4786139..93d329e 100644
--- a/asio/include/asio/detail/impl/handler_tracking.ipp
+++ b/asio/include/asio/detail/impl/handler_tracking.ipp
@@ -101,7 +101,8 @@
 
 void handler_tracking::creation(execution_context&,
     handler_tracking::tracked_handler& h,
-    const char* object_type, void* object, const char* op_name)
+    const char* object_type, void* object,
+    uintmax_t /*native_handle*/, const char* op_name)
 {
   static tracking_state* state = get_state();
 
@@ -256,7 +257,8 @@
 }
 
 void handler_tracking::operation(execution_context&,
-    const char* object_type, void* object, const char* op_name)
+    const char* object_type, void* object,
+    uintmax_t /*native_handle*/, const char* op_name)
 {
   static tracking_state* state = get_state();
 
diff --git a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp
index 1f84928..666f1d8 100644
--- a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp
+++ b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp
@@ -84,7 +84,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((reactor_.context(),
-          "descriptor", &impl, "close"));
+          "descriptor", &impl, impl.descriptor_, "close"));
 
     reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_,
         (impl.state_ & descriptor_ops::possible_dup) == 0);
@@ -125,7 +125,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((reactor_.context(),
-          "descriptor", &impl, "close"));
+          "descriptor", &impl, impl.descriptor_, "close"));
 
     reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_,
         (impl.state_ & descriptor_ops::possible_dup) == 0);
@@ -153,7 +153,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((reactor_.context(),
-          "descriptor", &impl, "release"));
+          "descriptor", &impl, impl.descriptor_, "release"));
 
     reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, false);
     construct(impl);
@@ -173,7 +173,7 @@
   }
 
   ASIO_HANDLER_OPERATION((reactor_.context(),
-        "descriptor", &impl, "cancel"));
+        "descriptor", &impl, impl.descriptor_, "cancel"));
 
   reactor_.cancel_ops(impl.descriptor_, impl.reactor_data_);
   ec = asio::error_code();
diff --git a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp
index f6fa6c3..6e7d240 100644
--- a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp
+++ b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp
@@ -83,7 +83,7 @@
   if (impl.socket_ != invalid_socket)
   {
     ASIO_HANDLER_OPERATION((reactor_.context(),
-          "socket", &impl, "close"));
+          "socket", &impl, impl.socket_, "close"));
 
     reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
         (impl.state_ & socket_ops::possible_dup) == 0);
@@ -100,7 +100,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((reactor_.context(),
-          "socket", &impl, "close"));
+          "socket", &impl, impl.socket_, "close"));
 
     reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_,
         (impl.state_ & socket_ops::possible_dup) == 0);
@@ -132,7 +132,7 @@
   }
 
   ASIO_HANDLER_OPERATION((reactor_.context(),
-        "socket", &impl, "cancel"));
+        "socket", &impl, impl.socket_, "cancel"));
 
   reactor_.cancel_ops(impl.socket_, impl.reactor_data_);
   ec = asio::error_code();
diff --git a/asio/include/asio/detail/impl/resolver_service_base.ipp b/asio/include/asio/detail/impl/resolver_service_base.ipp
index f03a949..92798d2 100644
--- a/asio/include/asio/detail/impl/resolver_service_base.ipp
+++ b/asio/include/asio/detail/impl/resolver_service_base.ipp
@@ -93,7 +93,7 @@
     resolver_service_base::implementation_type& impl)
 {
   ASIO_HANDLER_OPERATION((io_service_impl_.context(),
-        "resolver", &impl, "cancel"));
+        "resolver", &impl, 0, "cancel"));
 
   impl.reset();
 }
@@ -102,7 +102,7 @@
     resolver_service_base::implementation_type& impl)
 {
   ASIO_HANDLER_OPERATION((io_service_impl_.context(),
-        "resolver", &impl, "cancel"));
+        "resolver", &impl, 0, "cancel"));
 
   impl.reset(static_cast<void*>(0), socket_ops::noop_deleter());
 }
diff --git a/asio/include/asio/detail/impl/signal_set_service.ipp b/asio/include/asio/detail/impl/signal_set_service.ipp
index 41f60f7..f219e74 100644
--- a/asio/include/asio/detail/impl/signal_set_service.ipp
+++ b/asio/include/asio/detail/impl/signal_set_service.ipp
@@ -438,7 +438,7 @@
     asio::error_code& ec)
 {
   ASIO_HANDLER_OPERATION((io_service_.context(),
-        "signal_set", &impl, "cancel"));
+        "signal_set", &impl, 0, "cancel"));
 
   op_queue<operation> ops;
   {
diff --git a/asio/include/asio/detail/impl/strand_executor_service.hpp b/asio/include/asio/detail/impl/strand_executor_service.hpp
index fb81249..cb0256a 100644
--- a/asio/include/asio/detail/impl/strand_executor_service.hpp
+++ b/asio/include/asio/detail/impl/strand_executor_service.hpp
@@ -121,8 +121,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((impl->service_->context(),
-        *p.p, "strand_executor", impl.get(), "dispatch"));
+  ASIO_HANDLER_CREATION((impl->service_->context(), *p.p,
+        "strand_executor", impl.get(), 0, "dispatch"));
 
   // Add the function to the strand and schedule the strand if required.
   bool first = enqueue(impl, p.p);
@@ -150,8 +150,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((impl->service_->context(),
-        *p.p, "strand_executor", impl.get(), "post"));
+  ASIO_HANDLER_CREATION((impl->service_->context(), *p.p,
+        "strand_executor", impl.get(), 0, "post"));
 
   // Add the function to the strand and schedule the strand if required.
   bool first = enqueue(impl, p.p);
@@ -179,8 +179,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((impl->service_->context(),
-        *p.p, "strand_executor", impl.get(), "defer"));
+  ASIO_HANDLER_CREATION((impl->service_->context(), *p.p,
+        "strand_executor", impl.get(), 0, "defer"));
 
   // Add the function to the strand and schedule the strand if required.
   bool first = enqueue(impl, p.p);
diff --git a/asio/include/asio/detail/impl/strand_service.hpp b/asio/include/asio/detail/impl/strand_service.hpp
index bcd7b8f..09f96da 100644
--- a/asio/include/asio/detail/impl/strand_service.hpp
+++ b/asio/include/asio/detail/impl/strand_service.hpp
@@ -69,7 +69,7 @@
   p.p = new (p.v) op(handler);
 
   ASIO_HANDLER_CREATION((this->context(),
-        *p.p, "strand", impl, "dispatch"));
+        *p.p, "strand", impl, 0, "dispatch"));
 
   bool dispatch_immediately = do_dispatch(impl, p.p);
   operation* o = p.p;
@@ -104,7 +104,7 @@
   p.p = new (p.v) op(handler);
 
   ASIO_HANDLER_CREATION((this->context(),
-        *p.p, "strand", impl, "post"));
+        *p.p, "strand", impl, 0, "post"));
 
   do_post(impl, p.p, is_continuation);
   p.v = p.p = 0;
diff --git a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp
index 2945086..6b122a9 100644
--- a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp
+++ b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp
@@ -199,8 +199,8 @@
 {
   if (is_open(impl))
   {
-    ASIO_HANDLER_OPERATION((iocp_service_.context(),
-          "handle", &impl, "close"));
+    ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.handle_), "close"));
 
     if (!::CloseHandle(impl.handle_))
     {
@@ -234,8 +234,8 @@
     return ec;
   }
 
-  ASIO_HANDLER_OPERATION((iocp_service_.context(),
-        "handle", &impl, "cancel"));
+  ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle",
+        &impl, reinterpret_cast<uintmax_t>(impl.handle_), "cancel"));
 
   if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
         ::GetModuleHandleA("KERNEL32"), "CancelIoEx"))
@@ -509,8 +509,8 @@
 {
   if (is_open(impl))
   {
-    ASIO_HANDLER_OPERATION((iocp_service_.context(),
-          "handle", &impl, "close"));
+    ASIO_HANDLER_OPERATION((iocp_service_.context(), "handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.handle_), "close"));
 
     ::CloseHandle(impl.handle_);
     impl.handle_ = INVALID_HANDLE_VALUE;
diff --git a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp
index 853cdde..6f7886e 100644
--- a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp
+++ b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp
@@ -167,7 +167,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((iocp_service_.context(),
-          "socket", &impl, "close"));
+          "socket", &impl, impl.socket_, "close"));
 
     // Check if the reactor was created, in which case we need to close the
     // socket on the reactor as well to cancel any operations that might be
@@ -202,7 +202,7 @@
   }
 
   ASIO_HANDLER_OPERATION((iocp_service_.context(),
-        "socket", &impl, "cancel"));
+        "socket", &impl, impl.socket_, "cancel"));
 
   if (FARPROC cancel_io_ex_ptr = ::GetProcAddress(
         ::GetModuleHandleA("KERNEL32"), "CancelIoEx"))
@@ -621,7 +621,7 @@
   if (is_open(impl))
   {
     ASIO_HANDLER_OPERATION((iocp_service_.context(),
-          "socket", &impl, "close"));
+          "socket", &impl, impl.socket_, "close"));
 
     // Check if the reactor was created, in which case we need to close the
     // socket on the reactor as well to cancel any operations that might be
diff --git a/asio/include/asio/detail/impl/win_object_handle_service.ipp b/asio/include/asio/detail/impl/win_object_handle_service.ipp
index 737ae17..fff9832 100644
--- a/asio/include/asio/detail/impl/win_object_handle_service.ipp
+++ b/asio/include/asio/detail/impl/win_object_handle_service.ipp
@@ -177,8 +177,8 @@
 
   if (is_open(impl))
   {
-    ASIO_HANDLER_OPERATION((io_service_.context(),
-          "object_handle", &impl, "close"));
+    ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close"));
 
     HANDLE wait_handle = impl.wait_handle_;
     impl.wait_handle_ = INVALID_HANDLE_VALUE;
@@ -227,8 +227,8 @@
 {
   if (is_open(impl))
   {
-    ASIO_HANDLER_OPERATION((io_service_.context(),
-          "object_handle", &impl, "close"));
+    ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close"));
 
     mutex::scoped_lock lock(mutex_);
 
@@ -279,8 +279,8 @@
 {
   if (is_open(impl))
   {
-    ASIO_HANDLER_OPERATION((io_service_.context(),
-          "object_handle", &impl, "cancel"));
+    ASIO_HANDLER_OPERATION((io_service_.context(), "object_handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "cancel"));
 
     mutex::scoped_lock lock(mutex_);
 
diff --git a/asio/include/asio/detail/reactive_descriptor_service.hpp b/asio/include/asio/detail/reactive_descriptor_service.hpp
index 87775e8..6f5c71d 100644
--- a/asio/include/asio/detail/reactive_descriptor_service.hpp
+++ b/asio/include/asio/detail/reactive_descriptor_service.hpp
@@ -202,8 +202,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "descriptor", &impl, "async_wait"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
+          &impl, impl.descriptor_, "async_wait"));
 
     int op_type;
     switch (w)
@@ -265,8 +265,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.descriptor_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "descriptor", &impl, "async_write_some"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
+          &impl, impl.descriptor_, "async_write_some"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, true,
         buffer_sequence_adapter<asio::const_buffer,
@@ -288,8 +288,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "descriptor", &impl, "async_write_some(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
+          &impl, impl.descriptor_, "async_write_some(null_buffers)"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
     p.v = p.p = 0;
@@ -332,8 +332,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.descriptor_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "descriptor", &impl, "async_read_some"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
+          &impl, impl.descriptor_, "async_read_some"));
 
     start_op(impl, reactor::read_op, p.p, is_continuation, true,
         buffer_sequence_adapter<asio::mutable_buffer,
@@ -355,8 +355,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "descriptor", &impl, "async_read_some(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
+          &impl, impl.descriptor_, "async_read_some(null_buffers)"));
 
     start_op(impl, reactor::read_op, p.p, is_continuation, false, false);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/reactive_socket_service.hpp b/asio/include/asio/detail/reactive_socket_service.hpp
index d96b0ce..650a999 100644
--- a/asio/include/asio/detail/reactive_socket_service.hpp
+++ b/asio/include/asio/detail/reactive_socket_service.hpp
@@ -238,8 +238,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_send_to"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_send_to"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, true, false);
     p.v = p.p = 0;
@@ -259,8 +259,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_send_to(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_send_to(null_buffers)"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
     p.v = p.p = 0;
@@ -322,8 +322,8 @@
     p.p = new (p.v) op(impl.socket_, protocol,
         buffers, sender_endpoint, flags, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive_from"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive_from"));
 
     start_op(impl,
         (flags & socket_base::message_out_of_band)
@@ -347,8 +347,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive_from(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive_from(null_buffers)"));
 
     // Reset endpoint since it can be given no sensible value at this time.
     sender_endpoint = endpoint_type();
@@ -432,8 +432,8 @@
     p.p = new (p.v) op(impl.socket_, impl.state_, peer,
         impl.protocol_, peer_endpoint, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_accept"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_accept"));
 
     start_accept_op(impl, p.p, is_continuation, peer.is_open());
     p.v = p.p = 0;
@@ -457,8 +457,8 @@
     p.p = new (p.v) op(peer_io_service ? *peer_io_service : io_service_,
         impl.socket_, impl.state_, impl.protocol_, peer_endpoint, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_accept"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_accept"));
 
     start_accept_op(impl, p.p, is_continuation, false);
     p.v = p.p = 0;
@@ -488,8 +488,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_connect"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_connect"));
 
     start_connect_op(impl, p.p, is_continuation,
         peer_endpoint.data(), peer_endpoint.size());
diff --git a/asio/include/asio/detail/reactive_socket_service_base.hpp b/asio/include/asio/detail/reactive_socket_service_base.hpp
index 3e50b76..92c5525 100644
--- a/asio/include/asio/detail/reactive_socket_service_base.hpp
+++ b/asio/include/asio/detail/reactive_socket_service_base.hpp
@@ -210,8 +210,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_wait"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_wait"));
 
     int op_type;
     switch (w)
@@ -275,8 +275,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, buffers, flags, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_send"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_send"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, true,
         ((impl.state_ & socket_ops::stream_oriented)
@@ -299,8 +299,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_send(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_send(null_buffers)"));
 
     start_op(impl, reactor::write_op, p.p, is_continuation, false, false);
     p.v = p.p = 0;
@@ -345,8 +345,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive"));
 
     start_op(impl,
         (flags & socket_base::message_out_of_band)
@@ -373,8 +373,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive(null_buffers)"));
 
     start_op(impl,
         (flags & socket_base::message_out_of_band)
@@ -429,8 +429,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive_with_flags"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive_with_flags"));
 
     start_op(impl,
         (in_flags & socket_base::message_out_of_band)
@@ -455,8 +455,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((reactor_.context(),
-          *p.p, "socket", &impl, "async_receive_with_flags(null_buffers)"));
+    ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
+          &impl, impl.socket_, "async_receive_with_flags(null_buffers)"));
 
     // Clear out_flags, since we cannot give it any other sensible value when
     // performing a null_buffers operation.
diff --git a/asio/include/asio/detail/resolver_service.hpp b/asio/include/asio/detail/resolver_service.hpp
index e4932db..4505b04 100644
--- a/asio/include/asio/detail/resolver_service.hpp
+++ b/asio/include/asio/detail/resolver_service.hpp
@@ -80,7 +80,7 @@
     p.p = new (p.v) op(impl, query, io_service_impl_, handler);
 
     ASIO_HANDLER_CREATION((io_service_impl_.context(),
-          *p.p, "resolver", &impl, "async_resolve"));
+          *p.p, "resolver", &impl, 0, "async_resolve"));
 
     start_resolve_op(p.p);
     p.v = p.p = 0;
@@ -112,7 +112,7 @@
     p.p = new (p.v) op(impl, endpoint, io_service_impl_, handler);
 
     ASIO_HANDLER_CREATION((io_service_impl_.context(),
-          *p.p, "resolver", &impl, "async_resolve"));
+          *p.p, "resolver", &impl, 0, "async_resolve"));
 
     start_resolve_op(p.p);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/signal_set_service.hpp b/asio/include/asio/detail/signal_set_service.hpp
index c1e60d7..b726dba 100644
--- a/asio/include/asio/detail/signal_set_service.hpp
+++ b/asio/include/asio/detail/signal_set_service.hpp
@@ -153,7 +153,7 @@
     p.p = new (p.v) op(handler);
 
     ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "signal_set", &impl, "async_wait"));
+          *p.p, "signal_set", &impl, 0, "async_wait"));
 
     start_wait_op(impl, p.p);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/win_iocp_handle_service.hpp b/asio/include/asio/detail/win_iocp_handle_service.hpp
index e89f2a0..d052e18 100644
--- a/asio/include/asio/detail/win_iocp_handle_service.hpp
+++ b/asio/include/asio/detail/win_iocp_handle_service.hpp
@@ -151,8 +151,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
-    ASIO_HANDLER_CREATION((iocp_service_.context(),
-          *p.p, "handle", &impl, "async_write_some"));
+    ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
+          reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some"));
 
     start_write_op(impl, 0,
         buffer_sequence_adapter<asio::const_buffer,
@@ -172,8 +172,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
-    ASIO_HANDLER_CREATION((iocp_service_.context(),
-          *p.p, "handle", &impl, "async_write_some_at"));
+    ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
+          reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some_at"));
 
     start_write_op(impl, offset,
         buffer_sequence_adapter<asio::const_buffer,
@@ -213,8 +213,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
-    ASIO_HANDLER_CREATION((iocp_service_.context(),
-          *p.p, "handle", &impl, "async_read_some"));
+    ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
+          reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some"));
 
     start_read_op(impl, 0,
         buffer_sequence_adapter<asio::mutable_buffer,
@@ -235,8 +235,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(buffers, handler);
 
-    ASIO_HANDLER_CREATION((iocp_service_.context(),
-          *p.p, "handle", &impl, "async_read_some_at"));
+    ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
+          reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some_at"));
 
     start_read_op(impl, offset,
         buffer_sequence_adapter<asio::mutable_buffer,
diff --git a/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp b/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp
index 02671e4..9bd4799 100644
--- a/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp
+++ b/asio/include/asio/detail/win_iocp_overlapped_ptr.hpp
@@ -81,8 +81,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((io_service,
-          *p.p, "io_service", &io_service.impl_, "overlapped"));
+    ASIO_HANDLER_CREATION((io_service, *p.p,
+          "io_service", &io_service.impl_, 0, "overlapped"));
 
     io_service.impl_.work_started();
     reset();
diff --git a/asio/include/asio/detail/win_iocp_socket_service.hpp b/asio/include/asio/detail/win_iocp_socket_service.hpp
index 05a3ebf..bd485b3 100644
--- a/asio/include/asio/detail/win_iocp_socket_service.hpp
+++ b/asio/include/asio/detail/win_iocp_socket_service.hpp
@@ -316,8 +316,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_send_to"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_send_to"));
 
     buffer_sequence_adapter<asio::const_buffer,
         ConstBufferSequence> bufs(buffers);
@@ -339,8 +339,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_send_to(null_buffers)"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_send_to(null_buffers)"));
 
     start_reactor_op(impl, select_reactor::write_op, p.p);
     p.v = p.p = 0;
@@ -397,8 +397,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive_from"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive_from"));
 
     buffer_sequence_adapter<asio::mutable_buffer,
         MutableBufferSequence> bufs(buffers);
@@ -420,8 +420,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive_from(null_buffers)"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive_from(null_buffers)"));
 
     // Reset endpoint since it can be given no sensible value at this time.
     sender_endpoint = endpoint_type();
@@ -501,8 +501,8 @@
     p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_,
         peer_endpoint, enable_connection_aborted, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_accept"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_accept"));
 
     start_accept_op(impl, peer.is_open(), p.p->new_socket(),
         impl.protocol_.family(), impl.protocol_.type(),
@@ -529,8 +529,8 @@
         peer_io_service ? *peer_io_service : io_service_,
         peer_endpoint, enable_connection_aborted, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_accept"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_accept"));
 
     start_accept_op(impl, false, p.p->new_socket(),
         impl.protocol_.family(), impl.protocol_.type(),
@@ -560,8 +560,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.socket_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_connect"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_connect"));
 
     start_connect_op(impl, impl.protocol_.family(), impl.protocol_.type(),
         peer_endpoint.data(), static_cast<int>(peer_endpoint.size()), p.p);
diff --git a/asio/include/asio/detail/win_iocp_socket_service_base.hpp b/asio/include/asio/detail/win_iocp_socket_service_base.hpp
index 1e9ccb5..8e12a47 100644
--- a/asio/include/asio/detail/win_iocp_socket_service_base.hpp
+++ b/asio/include/asio/detail/win_iocp_socket_service_base.hpp
@@ -227,8 +227,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_wait"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_wait"));
 
     switch (w)
     {
@@ -286,8 +286,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_send"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_send"));
 
     buffer_sequence_adapter<asio::const_buffer,
         ConstBufferSequence> bufs(buffers);
@@ -309,8 +309,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_send(null_buffers)"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_send(null_buffers)"));
 
     start_reactor_op(impl, select_reactor::write_op, p.p);
     p.v = p.p = 0;
@@ -352,8 +352,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive"));
 
     buffer_sequence_adapter<asio::mutable_buffer,
         MutableBufferSequence> bufs(buffers);
@@ -375,8 +375,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive(null_buffers)"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive(null_buffers)"));
 
     start_null_buffers_receive_op(impl, flags, p.p);
     p.v = p.p = 0;
@@ -425,8 +425,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive_with_flags"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive_with_flags"));
 
     buffer_sequence_adapter<asio::mutable_buffer,
         MutableBufferSequence> bufs(buffers);
@@ -447,8 +447,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(impl.cancel_token_, handler);
 
-    ASIO_HANDLER_CREATION((io_service_,
-          *p.p, "socket", &impl, "async_receive_with_flags(null_buffers)"));
+    ASIO_HANDLER_CREATION((io_service_, *p.p, "socket",
+          &impl, impl.socket_, "async_receive_with_flags(null_buffers)"));
 
     // Reset out_flags since it can be given no sensible value at this time.
     out_flags = 0;
diff --git a/asio/include/asio/detail/win_object_handle_service.hpp b/asio/include/asio/detail/win_object_handle_service.hpp
index 95ae2d6..0caf527 100644
--- a/asio/include/asio/detail/win_object_handle_service.hpp
+++ b/asio/include/asio/detail/win_object_handle_service.hpp
@@ -137,8 +137,8 @@
       op::ptr::allocate(handler), 0 };
     p.p = new (p.v) op(handler);
 
-    ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "object_handle", &impl, "async_wait"));
+    ASIO_HANDLER_CREATION((io_service_.context(), *p.p, "object_handle",
+          &impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "async_wait"));
 
     start_wait_op(impl, p.p);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/winrt_resolver_service.hpp b/asio/include/asio/detail/winrt_resolver_service.hpp
index 8e16a5f..43520e2 100644
--- a/asio/include/asio/detail/winrt_resolver_service.hpp
+++ b/asio/include/asio/detail/winrt_resolver_service.hpp
@@ -130,7 +130,7 @@
     p.p = new (p.v) op(query, handler);
 
     ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "resolver", &impl, "async_resolve"));
+          *p.p, "resolver", &impl, 0, "async_resolve"));
 
     try
     {
diff --git a/asio/include/asio/detail/winrt_ssocket_service.hpp b/asio/include/asio/detail/winrt_ssocket_service.hpp
index 629518c..f539ac7 100644
--- a/asio/include/asio/detail/winrt_ssocket_service.hpp
+++ b/asio/include/asio/detail/winrt_ssocket_service.hpp
@@ -215,7 +215,7 @@
     p.p = new (p.v) op(handler);
 
     ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "socket", &impl, "async_connect"));
+          *p.p, "socket", &impl, 0, "async_connect"));
 
     start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation);
     p.v = p.p = 0;
diff --git a/asio/include/asio/detail/winrt_ssocket_service_base.hpp b/asio/include/asio/detail/winrt_ssocket_service_base.hpp
index 3103702..78017c3 100644
--- a/asio/include/asio/detail/winrt_ssocket_service_base.hpp
+++ b/asio/include/asio/detail/winrt_ssocket_service_base.hpp
@@ -203,7 +203,7 @@
     p.p = new (p.v) op(buffers, handler);
 
     ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "socket", &impl, "async_send"));
+          *p.p, "socket", &impl, 0, "async_send"));
 
     start_send_op(impl,
         buffer_sequence_adapter<asio::const_buffer,
@@ -259,7 +259,7 @@
     p.p = new (p.v) op(buffers, handler);
 
     ASIO_HANDLER_CREATION((io_service_.context(),
-          *p.p, "socket", &impl, "async_receive"));
+          *p.p, "socket", &impl, 0, "async_receive"));
 
     start_receive_op(impl,
         buffer_sequence_adapter<asio::mutable_buffer,
diff --git a/asio/include/asio/impl/io_service.hpp b/asio/include/asio/impl/io_service.hpp
index 610dd48..b6d1a69 100644
--- a/asio/include/asio/impl/io_service.hpp
+++ b/asio/include/asio/impl/io_service.hpp
@@ -95,7 +95,8 @@
       op::ptr::allocate(init.handler), 0 };
     p.p = new (p.v) op(init.handler);
 
-    ASIO_HANDLER_CREATION((*this, *p.p, "io_service", this, "dispatch"));
+    ASIO_HANDLER_CREATION((*this, *p.p,
+          "io_service", this, 0, "dispatch"));
 
     impl_.do_dispatch(p.p);
     p.v = p.p = 0;
@@ -124,7 +125,8 @@
       op::ptr::allocate(init.handler), 0 };
   p.p = new (p.v) op(init.handler);
 
-  ASIO_HANDLER_CREATION((*this, *p.p, "io_service", this, "post"));
+  ASIO_HANDLER_CREATION((*this, *p.p,
+        "io_service", this, 0, "post"));
 
   impl_.post_immediate_completion(p.p, is_continuation);
   p.v = p.p = 0;
@@ -188,7 +190,7 @@
   p.p = new (p.v) op(tmp, allocator);
 
   ASIO_HANDLER_CREATION((this->context(),
-        *p.p, "io_service", this, "post"));
+        *p.p, "io_service", this, 0, "post"));
 
   io_service_.impl_.post_immediate_completion(p.p, false);
   p.v = p.p = 0;
@@ -213,7 +215,7 @@
   p.p = new (p.v) op(tmp, allocator);
 
   ASIO_HANDLER_CREATION((this->context(),
-        *p.p, "io_service", this, "post"));
+        *p.p, "io_service", this, 0, "post"));
 
   io_service_.impl_.post_immediate_completion(p.p, false);
   p.v = p.p = 0;
@@ -238,7 +240,7 @@
   p.p = new (p.v) op(tmp, allocator);
 
   ASIO_HANDLER_CREATION((this->context(),
-        *p.p, "io_service", this, "defer"));
+        *p.p, "io_service", this, 0, "defer"));
 
   io_service_.impl_.post_immediate_completion(p.p, true);
   p.v = p.p = 0;
diff --git a/asio/include/asio/impl/system_executor.hpp b/asio/include/asio/impl/system_executor.hpp
index 3f4ab38..bcf429b 100644
--- a/asio/include/asio/impl/system_executor.hpp
+++ b/asio/include/asio/impl/system_executor.hpp
@@ -58,7 +58,7 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((ctx, *p.p, "system_executor", this, "post"));
+  ASIO_HANDLER_CREATION((ctx, *p.p, "system_executor", this, 0, "post"));
 
   ctx.scheduler_.post_immediate_completion(p.p, false);
   p.v = p.p = 0;
@@ -84,7 +84,7 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((ctx, *p.p, "system_executor", this, "defer"));
+  ASIO_HANDLER_CREATION((ctx, *p.p, "system_executor", this, 0, "defer"));
 
   ctx.scheduler_.post_immediate_completion(p.p, true);
   p.v = p.p = 0;
diff --git a/asio/include/asio/impl/thread_pool.hpp b/asio/include/asio/impl/thread_pool.hpp
index 445279d..7e9b6c4 100644
--- a/asio/include/asio/impl/thread_pool.hpp
+++ b/asio/include/asio/impl/thread_pool.hpp
@@ -73,7 +73,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((pool_, *p.p, "thread_pool", this, "post"));
+  ASIO_HANDLER_CREATION((pool_, *p.p,
+        "thread_pool", this, 0, "dispatch"));
 
   pool_.scheduler_.post_immediate_completion(p.p, false);
   p.v = p.p = 0;
@@ -97,7 +98,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((pool_, *p.p, "thread_pool", this, "post"));
+  ASIO_HANDLER_CREATION((pool_, *p.p,
+        "thread_pool", this, 0, "post"));
 
   pool_.scheduler_.post_immediate_completion(p.p, false);
   p.v = p.p = 0;
@@ -121,7 +123,8 @@
   p.v = p.a.allocate(1);
   p.p = new (p.v) op(tmp, allocator);
 
-  ASIO_HANDLER_CREATION((pool_, *p.p, "thread_pool", this, "defer"));
+  ASIO_HANDLER_CREATION((pool_, *p.p,
+        "thread_pool", this, 0, "defer"));
 
   pool_.scheduler_.post_immediate_completion(p.p, true);
   p.v = p.p = 0;