[llvm] [ORC] Fix synchronization in CoreAPIsTest. (PR #144556)
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 26 16:28:18 PDT 2025
================
@@ -1559,16 +1559,13 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) {
#if LLVM_ENABLE_THREADS
std::mutex WorkThreadsMutex;
- std::vector<std::thread> WorkThreads;
+ SmallVector<std::thread,0> WorkThreads;
DispatchOverride = [&](std::unique_ptr<Task> T) {
- std::promise<void> WaitP;
- std::lock_guard<std::mutex> Lock(WorkThreadsMutex);
+ std::unique_lock Lock(WorkThreadsMutex);
----------------
lhames wrote:
I think the movement is to scoped_lock over lock_guard, rather than to unique_lock.
I have a slight preference for making these kinds of cleanup (`std::vector` -> `SmallVector`, `lock_guard` -> `scoped_lock`) in a separate patch, so that the fix for the actual bug is as small as possible. This is a pretty small fix though, so as long as it's noted in the commit message doing the cleanup inline is probably ok.
https://github.com/llvm/llvm-project/pull/144556
More information about the llvm-commits
mailing list