Skip to content

Commit

Permalink
Merge pull request DOCGroup#2170 from DOCGroup/barrier_concurrency_fail
Browse files Browse the repository at this point in the history
Change ACE_Barrier running_threads_ to atomic to ensure accurate values across cores/CPUs
  • Loading branch information
shuston authored Jan 12, 2024
2 parents 7efcd5f + 4689fd0 commit 8c49e7b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ACE/ace/Barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL

#else /* ACE_HAS_THREADS */

#include <atomic>
#include "ace/Condition_Thread_Mutex.h"

ACE_BEGIN_VERSIONED_NAMESPACE_DECL
Expand All @@ -63,7 +64,7 @@ struct ACE_Export ACE_Sub_Barrier
ACE_Condition_Thread_Mutex barrier_finished_;

/// Number of threads that are still running.
int running_threads_;
std::atomic<int> running_threads_;

/// Dump the state of an object.
void dump () const;
Expand Down

0 comments on commit 8c49e7b

Please sign in to comment.