This is an automated email from the ASF dual-hosted git repository.

guangmingchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new 09caf65d Fix a redundant BeforeAdditionalRefReleased call (#3174)
09caf65d is described below

commit 09caf65d6223ecc509afe4ad5ad5da2347813a98
Author: Bright Chen <[email protected]>
AuthorDate: Wed Dec 17 20:32:01 2025 +0800

    Fix a redundant BeforeAdditionalRefReleased call (#3174)
---
 src/brpc/versioned_ref_with_id.h              | 9 ++++-----
 test/bthread_work_stealing_queue_unittest.cpp | 9 ++-------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/brpc/versioned_ref_with_id.h b/src/brpc/versioned_ref_with_id.h
index 20e0106d..f77d5afa 100644
--- a/src/brpc/versioned_ref_with_id.h
+++ b/src/brpc/versioned_ref_with_id.h
@@ -504,10 +504,9 @@ int VersionedRefWithId<T>::ReleaseAdditionalReference() {
     do {
         AdditionalRefStatus expect = ADDITIONAL_REF_USING;
         if (_additional_ref_status.compare_exchange_strong(
-            expect, ADDITIONAL_REF_RECYCLED,
-            butil::memory_order_relaxed,
-            butil::memory_order_relaxed)) {
-            BeforeAdditionalRefReleasedWrapper();
+                expect, ADDITIONAL_REF_RECYCLED,
+                butil::memory_order_relaxed,
+                butil::memory_order_relaxed)) {
             WRAPPER_CALL(BeforeAdditionalRefReleased, static_cast<T*>(this));
             return Dereference();
         }
@@ -591,7 +590,7 @@ void VersionedRefWithId<T>::Revive(int32_t at_least_nref) {
 
         int32_t nref = NRefOfVRef(vref);
         if (nref < at_least_nref) {
-            // Set the status to REF_RECYLED since no one uses this socket
+            // Set the status to REF_RECYCLED since no one uses this socket
             _additional_ref_status.store(
                 ADDITIONAL_REF_RECYCLED, butil::memory_order_relaxed);
             CHECK_EQ(1, nref);
diff --git a/test/bthread_work_stealing_queue_unittest.cpp 
b/test/bthread_work_stealing_queue_unittest.cpp
index 92fbb910..a8b11037 100644
--- a/test/bthread_work_stealing_queue_unittest.cpp
+++ b/test/bthread_work_stealing_queue_unittest.cpp
@@ -21,6 +21,7 @@
 #include "butil/macros.h"
 #include "butil/scoped_lock.h"
 #include "bthread/work_stealing_queue.h"
+#include "bthread/processor.h"
 
 namespace {
 typedef size_t value_type;
@@ -39,13 +40,7 @@ void* steal_thread(void* arg) {
         if (q->steal(&val)) {
             stolen->push_back(val);
         } else {
-#if defined(ARCH_CPU_ARM_FAMILY)
-            asm volatile("yield\n": : :"memory");
-#elif defined(ARCH_CPU_LOONGARCH64_FAMILY)
-            asm volatile("nop\n": : :"memory");
-#else
-            asm volatile("pause\n": : :"memory");
-#endif
+            cpu_relax();
         }
     }
     return stolen;


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

Reply via email to