[Support] Attempt to fix deadlock in ThreadGroup
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Sat, 18 Sep 2021 16:00:17 +0000 (12:00 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Sat, 18 Sep 2021 17:49:10 +0000 (13:49 -0400)
commit7b25fa8c7a151e94be46ed8f0a56bf4e2af1c104
treeb976ba9912aa42eda803c9fd86420ab06985cbb2
parentcb5e3f79592416cc5c1413655eddc641b1dae920
[Support] Attempt to fix deadlock in ThreadGroup

This is an attempt to fix the situation described by https://reviews.llvm.org/D104207#2826290 and PR41508.
See sequence of operations leading to the bug in https://reviews.llvm.org/D104207#3004689

We ensure that the Latch is completely "free" before decrementing the number of TaskGroupInstances.

Differential revision: https://reviews.llvm.org/D109914
llvm/include/llvm/Support/Parallel.h
llvm/lib/Support/Parallel.cpp