vector/rasterizer: safe rletask reset. 73/216573/1
authorsubhransu mohanty <sub.mohanty@samsung.com>
Mon, 28 Oct 2019 07:17:22 +0000 (16:17 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 29 Oct 2019 05:48:42 +0000 (14:48 +0900)
check if the previous task is finished before reseting the task .
if the previous task is not finished may lead to inconsistant task state.

Change-Id: I934636745fcc87474d511eaa1c7f9a44027f8d60

src/vector/vraster.cpp

index 80e7537..fb340db 100644 (file)
@@ -275,18 +275,27 @@ public:
         }
         _cv.notify_one();
     }
-    VRle &get()
+    void wait()
     {
-        if (!_pending) return _rle;
+        if (!_pending) return;
+
+        {
+            std::unique_lock<std::mutex> lock(_mutex);
+            while (!_ready) _cv.wait(lock);
+        }
 
-        std::unique_lock<std::mutex> lock(_mutex);
-        while (!_ready) _cv.wait(lock);
         _pending = false;
+    }
+
+    VRle &get()
+    {
+        wait();
         return _rle;
     }
 
     void reset()
     {
+        wait();
         _ready = false;
         _pending = true;
     }