-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCL] Fix a thread pool data race during shutdown (#15535)
The flag that kills the threads waiting for work was an atomic bool, but that is not enough: any modification of a condition must be made under the mutex associated with that condition variable. Otherwise, the bool value flip and the call to notify might happen after the condition check in the other thread, but before it starts waiting for notifications.
- Loading branch information
1 parent
23fed07
commit 8fc9aa5
Showing
2 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// RUN: %{build} -o %t.out | ||
// RUN: %{run} %t.out | ||
|
||
#include <sycl/detail/core.hpp> | ||
|
||
using namespace sycl; | ||
|
||
// This test checks that host tasks that haven't been waited for do not cause | ||
// issues during shutdown. | ||
int main(int argc, char *argv[]) { | ||
queue q; | ||
|
||
q.submit([&](handler &h) { h.host_task([=]() {}); }); | ||
|
||
return 0; | ||
} |