From 7cf310ef7d25b7e6553c7af8da53af9d5123b84d Mon Sep 17 00:00:00 2001 From: Lukasz Pawelczyk Date: Mon, 15 Jun 2015 13:52:25 +0200 Subject: [PATCH] Unlock the latch even in the case of an exception [Feature] N/A [Cause] If an exception is thrown during execute() the calling thread's latch will never be unlocked. [Solution] Unlock the latch after the whole try/catch. [Verification] Built, installed, run tests Change-Id: I2891d83f4f3459a2d2d60cdc4d2986e37894c959 --- common/utils/worker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/utils/worker.cpp b/common/utils/worker.cpp index e73c4ce..09069e8 100644 --- a/common/utils/worker.cpp +++ b/common/utils/worker.cpp @@ -150,11 +150,11 @@ private: try { LOGT("Executing task from subgroup " << taskInfo.groupID); taskInfo.task(); - if (taskInfo.latch) - taskInfo.latch->set(); } catch (const std::exception& e) { LOGE("Unexpected exception while executing task: " << e.what()); } + if (taskInfo.latch) + taskInfo.latch->set(); } }; -- 2.7.4