Copilot commented on code in PR #13881:
URL: https://github.com/apache/trafficserver/pull/13881#discussion_r4339191477
##########
include/iocore/eventsystem/Action.h:
##########
@@ -89,6 +93,49 @@ class Action
*/
bool cancelled = false;
+ /**
+ Calls back @c continuation for this operation unless the operation has
+ been cancelled.
+
+ @param[in] event The event code passed to the handler.
+ @param[in] data The data passed to the handler.
+
+ @return Returns the handler's return value, or an empty optional if
+ the operation has been cancelled.
+
+ @pre If the operation has not been cancelled, @c continuation points
+ to a live Continuation with a handler installed, and
+ @c continuation->mutex and @c mutex are both null or refer to
+ the same mutex.
+
+ @note The handler may destroy @c continuation and this Action. Unless
+ the owner documents otherwise, do not access either after this
+ call returns.
+
+ @note If @p data transfers ownership of an object to @c continuation,
+ the caller must dispose of that object when the result is empty.
+
+ @par Thread Safety
+ Not thread-safe. The caller must hold @c mutex where non-null.
+ */
+ std::optional<int>
+ call_back(int event, void *data)
+ {
Review Comment:
Because `call_back` returns `std::optional<int>` and the documentation notes
callers may need to dispose of `data` when the result is empty, it’s easy for
call sites to accidentally ignore the return value and miss required cleanup.
Consider marking `call_back` as `[[nodiscard]]` (mandatory if `data` ownership
is commonly conditional; otherwise optional) to make incorrect usage harder.
--
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]