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


##########
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:
+  explicit TSMutexLockGuard(TSMutex mutexp) : m_mutex(mutexp) { 
TSMutexLock(m_mutex); }

Review Comment:
   Good idea, thanks. I added [[nodiscard]] to the constructor. I left off the
   custom message because ts.h still permits C++17 plugin builds, and Clang 
treats
   the string-literal form as a C++20 extension in strict C++17 mode.
   



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