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

wwbmmm 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 5cd340e7 fix: add acquire fence in bthread_join for ARM memory 
visibility (#3276)
5cd340e7 is described below

commit 5cd340e79b5fde264ce2e47e96e7f9cdf708d12f
Author: guoliushui <[email protected]>
AuthorDate: Mon May 11 19:54:18 2026 +0800

    fix: add acquire fence in bthread_join for ARM memory visibility (#3276)
    
    * fix: add acquire fence in bthread_join for ARM memory visibility
    
    Ensure memory visibility on ARM architecture after thread join.
    
    * use the fence unconditionally
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI 
<[email protected]>
---
 src/bthread/task_group.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/bthread/task_group.cpp b/src/bthread/task_group.cpp
index 579bb231..c421d2f2 100644
--- a/src/bthread/task_group.cpp
+++ b/src/bthread/task_group.cpp
@@ -635,6 +635,10 @@ int TaskGroup::join(bthread_t tid, void** return_value) {
             return errno;
         }
     }
+    // Ensure all memory writes made by the joined bthread are visible to
+    // the joining thread after join returns. This matches the semantic
+    // guarantee provided by pthread_join() across supported architectures.
+    butil::atomic_thread_fence(butil::memory_order_acquire);
     if (return_value) {
         *return_value = NULL;
     }


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

Reply via email to