From 0696569fbfb76b485624de24462aaf10d84f415d Mon Sep 17 00:00:00 2001 From: Francis Murtagh Date: Thu, 5 Sep 2019 16:29:01 +0100 Subject: IVGCVSW-3432 Create CaptureData Holder * Fix race condition where result was read before execution of write Change-Id: I8961c4ce5a9000cb4d465106fe56e615beecf4dc Signed-off-by: Francis Murtagh --- src/profiling/test/ProfilingTests.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/profiling') diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index c7b0bda0ff..58609528e4 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -403,10 +403,11 @@ BOOST_AUTO_TEST_CASE(CheckCaptureDataHolder) BOOST_CHECK(captureData.GetCounterIds() == counterIds3); std::thread thread3(CaptureDataWriteThreadImpl, std::ref(holder), capturePeriod2, std::ref(counterIds1)); - std::thread thread4(CaptureDataReadThreadImpl, std::ref(holder), std::ref(captureData)); - std::thread thread5(CaptureDataWriteThreadImpl, std::ref(holder), capturePeriod1, std::ref(counterIds2)); + std::thread thread4(CaptureDataWriteThreadImpl, std::ref(holder), capturePeriod1, std::ref(counterIds2)); thread3.join(); thread4.join(); + + std::thread thread5(CaptureDataReadThreadImpl, std::ref(holder), std::ref(captureData)); thread5.join(); // Check CaptureData was written/read correctly from multiple threads -- cgit v1.2.1