Modify PushAndWaitAndPop test case 40/286940/1
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 17 Jan 2023 06:41:41 +0000 (06:41 +0000)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 17 Jan 2023 06:41:41 +0000 (06:41 +0000)
The previous implementation has a timing issue. This patch is to fix the issue.
The main thread calls WaitAndPop() method and the thread calls Push() method.

Change-Id: Id4b19b6fee1c31f2ebd8bed16dbc782161c3c8e5
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
tests/tizen-shared-queue_unittests/test_shared_queue.cc

index d41ca40..e12e28c 100644 (file)
@@ -41,12 +41,10 @@ class Job {
 TEST(SharedQueueTest, PushAndWaitAndPop) {
   tizen_base::SharedQueue<Job> queue;
   std::thread thread([&] {
-        auto job = queue.WaitAndPop();
+        Job job;
         job.Do();
         queue.Push(std::move(job));
       });
-  queue.Push(Job());
-  usleep(100);
   auto job = queue.WaitAndPop();
   thread.join();