tcuThreadUtil: fix data races on m_status
authorTapani Pälli <tapani.palli@intel.com>
Tue, 27 Aug 2019 10:50:09 +0000 (13:50 +0300)
committerAlexander Galazin <Alexander.Galazin@arm.com>
Fri, 4 Oct 2019 09:57:11 +0000 (05:57 -0400)
commitdfa0bc32104edb6682d2a8bff44d63c8f522e8ba
tree59122b0430d50dc02bd5b9f27e3b59ba8309238a
parentb79b96d13aeee6ba285d01f964464b4488c9fe15
tcuThreadUtil: fix data races on m_status

Fixes data race where m_status is being read by Thread::getStatus() and
simultaneously written by Thread::run(). There are multiple instances of
these errors during dEQP-EGL.functional.sharing.gles2.multithread.*
tests.

 ==14810== Possible data race during write of size 4 at 0x5E79E30 by thread #4
 ==14810== Locks held: none
 ==14810==    at 0x7214AF: tcu::ThreadUtil::Thread::run()
 ==14810==    by 0x74F348: de::threadFunc(void*)
 ==14810==    by 0x756B89: startThread
 ==14810==    by 0x483F76D: mythread_wrapper (hg_intercepts.c:389)
 ==14810==    by 0x4A195A1: start_thread (in /usr/lib64/libpthread-2.29.so)
 ==14810==    by 0x4ED8022: clone (in /usr/lib64/libc-2.29.so)
 ==14810==
 ==14810== This conflicts with a previous read of size 4 by thread #1
 ==14810== Locks held: none
 ==14810==    at 0x48E076: tcu::ThreadUtil::Thread::getStatus() const
 ==14810==    by 0x47E911: deqp::egl::GLES2SharingRandomTest::iterate()
 ==14810==    by 0x45F044: deqp::egl::TestCaseWrapper::iterate(tcu::TestCase*)
 ==14810==    by 0x6F7829: tcu::TestSessionExecutor::iterateTestCase(tcu::TestCase*)
 ==14810==    by 0x6F6854: tcu::TestSessionExecutor::iterate()
 ==14810==    by 0x6C84C2: tcu::App::iterate()
 ==14810==    by 0x45A57A: main
 ==14810==  Address 0x5e79e30 is 96 bytes inside a block of size 200 alloc'd

Components: EGL
VK-GL-CTS issue: 1955
Affects: dEQP-EGL.functional.sharing.gles2.multithread.*

Change-Id: I9b8a069743fc2271a962e69dd0c7f18490119e97
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
framework/common/tcuThreadUtil.cpp
framework/common/tcuThreadUtil.hpp