Skip to content

Commit 6acc122

Browse files
xjzerMario-DL
authored andcommitted
Fix double-locking issue in DataSharingListener (#5468)
Signed-off-by: Xiaojing Cao <[email protected]> (cherry picked from commit 059457a)
1 parent aef5108 commit 6acc122

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/cpp/rtps/DataSharing/DataSharingListener.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,15 @@ DataSharingListener::~DataSharingListener()
5656

5757
void DataSharingListener::run()
5858
{
59-
std::unique_lock<Segment::mutex> lock(notification_->notification_->notification_mutex, std::defer_lock);
6059
while (is_running_.load())
6160
{
6261
try
6362
{
64-
lock.lock();
63+
std::unique_lock<Segment::mutex> lock(notification_->notification_->notification_mutex);
6564
notification_->notification_->notification_cv.wait(lock, [&]
6665
{
6766
return !is_running_.load() || notification_->notification_->new_data.load();
6867
});
69-
70-
lock.unlock();
7168
}
7269
catch (const boost::interprocess::interprocess_exception& /*e*/)
7370
{

0 commit comments

Comments
 (0)