File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
arccore/src/concurrency/arccore/concurrency Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -120,14 +120,17 @@ class StdThreadBarrier
120
120
{
121
121
std::unique_lock<std::mutex> lk (m_wait_mutex);
122
122
++m_current_reached;
123
+ Int32 generation = m_generation;
123
124
// cout << "ADD BARRIER N=" << m_current_reached << '\n';
124
125
if (m_current_reached == m_nb_thread) {
126
+ ++m_generation;
125
127
m_current_reached = 0 ;
126
128
is_last = true ;
127
129
// cout << "BROADCAST BARRIER N=" << m_current_reached << '\n';
130
+ lk.unlock ();
128
131
m_wait.notify_all ();
129
132
}
130
- else
133
+ while (generation == m_generation)
131
134
m_wait.wait (lk);
132
135
}
133
136
return is_last;
@@ -139,6 +142,7 @@ class StdThreadBarrier
139
142
std::condition_variable m_wait;
140
143
Integer m_nb_thread = 0 ;
141
144
Integer m_current_reached = 0 ;
145
+ Int32 m_generation = 0 ;
142
146
};
143
147
144
148
/* ---------------------------------------------------------------------------*/
You can’t perform that action at this time.
0 commit comments