Skip to content

Commit 8ae8bf2

Browse files
[SYCL] Fix usage of std::conditional_variable in sycl::event (#6284)
PR #6245 introduced a misuse of it. I've misunderstood The notifying thread does not need to hold the lock on the same mutex as the one held by the waiting thread(s) from https://en.cppreference.com/w/cpp/thread/condition_variable/notify_all Instead, https://en.cppreference.com/w/cpp/thread/condition_variable The thread that intends to modify the shared variable has to... should be followed.
1 parent ccaaa99 commit 8ae8bf2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sycl/source/detail/event_impl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ void event_impl::waitInternal() {
7070

7171
void event_impl::setComplete() {
7272
if (MHostEvent || !MEvent) {
73+
std::unique_lock lock(MMutex);
7374
#ifndef NDEBUG
7475
int Expected = HES_NotComplete;
7576
int Desired = HES_Complete;

0 commit comments

Comments
 (0)