You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by ww...@apache.org on 2026/05/11 11:54:24 UTC

(brpc) branch master updated: fix: add acquire fence in bthread_join for ARM memory visibility (#3276)

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 <97...@qq.com>
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 <17...@users.noreply.github.com>
    
    ---------
    
    Co-authored-by: Copilot Autofix powered by AI <17...@users.noreply.github.com>
---
 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: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org