Skip to content

Commit ac48e55

Browse files
authored
Merge pull request #239 from bangerth/fix
Make sure we acquire both locks in another place as well.
2 parents 89be931 + 1aa6063 commit ac48e55

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/sampleflow/consumer.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,11 @@ namespace SampleFlow
496496
// but we don't care about that) and terminate it. We have to be mindful
497497
// that this function may have been called at the same time as a sample
498498
// was sent, and because the sample processing machinery queries the
499-
// state of the connections, we need to do things under a
500-
// mutex
499+
// state of the connections, we need to do things under the
500+
// mutices for both synchronous and asynchronous mode:
501501
{
502-
std::lock_guard<std::mutex> parallel_lock (asynchronous_mode_mutex);
502+
std::lock_guard<std::mutex> parallel_lock_1 (asynchronous_mode_mutex);
503+
std::unique_lock<std::shared_mutex> parallel_lock_2 (synchronous_mode_mutex);
503504

504505
auto x = connections_to_producers.find(&p);
505506

0 commit comments

Comments
 (0)