Skip to content

Commit dd1edc3

Browse files
committed
Fixes #281 ("Locks in message_queue_t cover more code than intended?")
1 parent 86579fe commit dd1edc3

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

include/boost/interprocess/ipc/message_queue.hpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -801,10 +801,11 @@ inline bool message_queue_t<VoidPointer>::do_send(
801801
}
802802

803803
bool notify_blocked_receivers = false;
804-
//---------------------------------------------
805-
scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
806-
//---------------------------------------------
807804
{
805+
//---------------------------------------------
806+
scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
807+
//---------------------------------------------
808+
808809
//If the queue is full execute blocking logic
809810
if (p_hdr->is_full()) {
810811
BOOST_INTERPROCESS_TRY{
@@ -911,10 +912,11 @@ inline bool
911912
}
912913

913914
bool notify_blocked_senders = false;
914-
//---------------------------------------------
915-
scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
916-
//---------------------------------------------
917915
{
916+
//---------------------------------------------
917+
scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
918+
//---------------------------------------------
919+
918920
//If there are no messages execute blocking logic
919921
if (p_hdr->is_empty()) {
920922
BOOST_INTERPROCESS_TRY{

0 commit comments

Comments
 (0)