From 4878eece18057b563452421a54979f7f11bad8fb Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Mon, 30 Apr 2018 11:52:58 +0200 Subject: [PATCH 1/1] xbt_cond_timedwait: mutex is not held on timeout. --- messages.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/messages.cpp b/messages.cpp index 39c4f0f..547a29f 100644 --- a/messages.cpp +++ b/messages.cpp @@ -78,9 +78,6 @@ bool message_queue::pop(message*& msg, msg_host_t& from, double timeout) else cond.wait(mutex); } - TRY_CLEANUP { - mutex.release(); - } CATCH (e) { if (e.category != timeout_error) RETHROW; @@ -89,9 +86,8 @@ bool message_queue::pop(message*& msg, msg_host_t& from, double timeout) } bool pop_was_successful = queue.try_pop(task); xbt_assert(pop_was_successful); - } else { - mutex.release(); } + mutex.release(); } msg = static_cast(MSG_task_get_data(task)); from = MSG_task_get_source(task); -- 2.39.5