Copilot commented on code in PR #13804:
URL: https://github.com/apache/trafficserver/pull/13804#discussion_r4206586754


##########
include/iocore/eventsystem/Continuation.h:
##########
@@ -230,22 +369,87 @@ class Continuation : private force_VFPT_to_top
 
 protected:
   /**
-    Constructor of the Continuation object. It should not be used
-    directly. Instead create an object of a derived type.
+    Constructs a Continuation protected by @p amutex.
+
+    The Continuation shares ownership of @p amutex with every other
+    reference to it, so passing a freshly created mutex makes the
+    Continuation its sole owner, and the mutex is destroyed with the
+    Continuation unless another reference is taken first.
 
-    @param amutex Lock to be set for this Continuation.
+    @param[in] amutex The mutex to protect this Continuation, or nullptr.
+                      See @c mutex for the restrictions on dispatching a
+                      Continuation whose mutex is null.
 
+    @pre  @p amutex is null or points to a live @c ProxyMutex.
+
+    @post @c mutex refers to @p amutex.
+    @post @c control_flags equals the calling thread's current control
+          flags. Later changes to the calling thread's flags do not
+          affect it.
+    @post @c handler is null. The derived class must install a handler
+          before any event is dispatched to this Continuation.
+
+    @par Thread Safety
+      Safe to call concurrently with other code that takes or releases
+      references to @p amutex.

Review Comment:
   This overstates the raw-pointer overload's thread safety. Constructing 
`mutex` increments through `amutex`, so if another thread releases the final 
existing reference first, the mutex can be freed before this constructor 
increments it. Require the caller to pin the mutex lifetime during 
construction; only then may other references be changed concurrently.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to