aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
authorLechen Yu <lechenyu21@gmail.com>2022-10-31 15:36:58 +0100
committerJoachim Protze <protze@itc.rwth-aachen.de>2022-10-31 15:38:22 +0100
commitb923c15d3c00c78a7b9258e79755df9587e1f0b1 (patch)
treec7c85e20a185010fae7e91636e53ff865de54357 /llvm/unittests/Support/CommandLineTest.cpp
parentaf91b19338dde956ce7ebd6890d1a8e4295b091b (diff)
downloadllvm-b923c15d3c00c78a7b9258e79755df9587e1f0b1.zip
llvm-b923c15d3c00c78a7b9258e79755df9587e1f0b1.tar.gz
llvm-b923c15d3c00c78a7b9258e79755df9587e1f0b1.tar.bz2
[libomptarget] Fix a race condition in checkDeviceAndCtors
When multiple threads invoke checkDeviceAndCtors, both of them may read true from the shared variable Device.HasPendingGlobals, and then invoke initLibrary redundantly. Therefore only protecting the access to Device.HasPendingGlobals is not sufficient to guarantee that initLibrary is invoked just once. To fix this race condition, we move the invocation of initLibrary into the critical section, and remove the same lock inside initLibrary. Differential Revision: https://reviews.llvm.org/D136952
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
0 files changed, 0 insertions, 0 deletions