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


##########
include/ts/ts.h:
##########
@@ -1168,6 +1168,26 @@ TSReturnCode TSMutexLockTry(TSMutex mutexp);
 
 void TSMutexUnlock(TSMutex mutexp);
 
+/** Scoped lock guard for a @c TSMutex.
+
+    Locks @a mutexp on construction and unlocks it when the guard leaves scope.
+ */
+class TSMutexLockGuard
+{
+public:
+  [[nodiscard]] explicit TSMutexLockGuard(TSMutex mutexp) : m_mutex(mutexp) { 
TSMutexLock(m_mutex); }

Review Comment:
   `[[nodiscard]]` is currently applied to the constructor. Since `ts.h` allows 
plugins to compile as C++17 (`__cplusplus >= 201703L`), it would be safer to 
put `[[nodiscard]]` on the class declaration instead (C++17-supported) to 
ensure consistent behavior and avoid potential compiler diagnostics about 
`[[nodiscard]]` on constructors in older language modes.
   



-- 
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