From 59f58a6baf2996c5bc9f23952a5f77eb34ba4dc4 Mon Sep 17 00:00:00 2001
From: foreman
Date: Fri, 4 May 2018 16:30:54 -0400
Subject: [PATCH] P4 to Git Change 1550567 by lmoriche@lmoriche_opencl_dev2 on
2018/05/04 16:11:50
SWDEV-145570 - [HIP] - Fix a race condition in the CommandQueue::Thread destruction.
Affected files ...
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#25 edit
[ROCm/clr commit: 64d2ad6a88f5253905565fea74c3854bd2549c5a]
---
.../clr/rocclr/runtime/platform/commandqueue.cpp | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/projects/clr/rocclr/runtime/platform/commandqueue.cpp b/projects/clr/rocclr/runtime/platform/commandqueue.cpp
index 3604820d47..8710adc3c5 100644
--- a/projects/clr/rocclr/runtime/platform/commandqueue.cpp
+++ b/projects/clr/rocclr/runtime/platform/commandqueue.cpp
@@ -31,14 +31,12 @@ HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properti
bool HostQueue::terminate() {
if (Os::isThreadAlive(thread_)) {
- // Make sure all the commands are finished on the device.
- finish();
-
- // Kill the command queue loop.
- thread_.acceptingCommands_ = false;
-
// Wake-up the command loop, so it can exit
- flush();
+ {
+ ScopedLock sl(queueLock_);
+ thread_.acceptingCommands_ = false;
+ queueLock_.notify();
+ }
// FIXME_lmoriche: fix termination handshake
while (thread_.state() < Thread::FINISHED) {