Skip to content

Commit

Permalink
[core] Fix possible race condition (#1527)
Browse files Browse the repository at this point in the history
ecal_registration_provider.cpp: m_sample_list_sync should also protect m_sample_list_buffer.
  • Loading branch information
KerstinKeller committed Apr 16, 2024
1 parent 0f9d14b commit 5c191f2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions ecal/core/src/ecal_registration_provider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,10 @@ namespace eCAL

if(m_use_shm_monitoring)
{
{
const std::lock_guard<std::mutex> lock(m_sample_list_sync);
m_sample_list.SerializeToString(&m_sample_list_buffer);
if(reset_sample_list_)
m_sample_list.clear_samples();
}
const std::lock_guard<std::mutex> lock(m_sample_list_sync);
m_sample_list.SerializeToString(&m_sample_list_buffer);
if(reset_sample_list_)
m_sample_list.clear_samples();

if(!m_sample_list_buffer.empty())
return_value &=m_memfile_broadcast_writer.Write(m_sample_list_buffer.data(), m_sample_list_buffer.size());
Expand Down

0 comments on commit 5c191f2

Please sign in to comment.