Mryange commented on code in PR #63109:
URL: https://github.com/apache/doris/pull/63109#discussion_r3246439426


##########
be/src/common/thread_safety_annotations.h:
##########
@@ -119,6 +141,32 @@ class SCOPED_CAPABILITY LockGuard {
     MutexType& _mu;
 };
 
+// RAII scoped shared lock guard annotated for thread safety analysis.
+// In BE_TEST builds, injects a random sleep before acquiring and after
+// releasing the lock to exercise concurrent code paths.
+template <typename MutexType>
+class SCOPED_CAPABILITY SharedLockGuard {
+public:
+    explicit SharedLockGuard(MutexType& mu) ACQUIRE_SHARED(mu) : _mu(mu) {
+#ifdef BE_TEST
+        doris::mock_random_sleep();
+#endif
+        _mu.lock_shared();

Review Comment:
   不对,~SharedLockGuard() RELEASE() 是可以的,而且在这里更应该保持 RELEASE(),不要改成 
RELEASE_SHARED()。



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to