Unlock the latch even in the case of an exception 54/41454/2
authorLukasz Pawelczyk <l.pawelczyk@samsung.com>
Mon, 15 Jun 2015 11:52:25 +0000 (13:52 +0200)
committerDariusz Michaluk <d.michaluk@samsung.com>
Mon, 15 Jun 2015 12:59:00 +0000 (05:59 -0700)
[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

index e73c4ce..09069e8 100644 (file)
@@ -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();
     }
 };