P4 to Git Change 1551367 by lmoriche@lmoriche_opencl_dev2 on 2018/05/07 18:40:02

SWDEV-145570 - [HIP] - Fix a race condition in the CommandQueue::Thread destruction.

Affected files ...

... //depot/stg/opencl/drivers/opencl/runtime/os/os_posix.cpp#44 edit
... //depot/stg/opencl/drivers/opencl/runtime/platform/commandqueue.cpp#26 edit
Этот коммит содержится в:
foreman
2018-05-07 18:50:50 -04:00
родитель c06ffcf665
Коммит 7fe8b95168
2 изменённых файлов: 21 добавлений и 3 удалений
+18 -2
Просмотреть файл
@@ -31,9 +31,25 @@ HostQueue::HostQueue(Context& context, Device& device, cl_command_queue_properti
bool HostQueue::terminate() {
if (Os::isThreadAlive(thread_)) {
Command* marker = nullptr;
// Send a finish if the queue is still accepting commands.
{ ScopedLock sl(queueLock_);
if (thread_.acceptingCommands_) {
marker = new Marker(*this, false);
if (marker != nullptr) {
append(*marker);
queueLock_.notify();
}
}
}
if (marker != nullptr) {
marker->awaitCompletion();
marker->release();
}
// Wake-up the command loop, so it can exit
{
ScopedLock sl(queueLock_);
{ ScopedLock sl(queueLock_);
thread_.acceptingCommands_ = false;
queueLock_.notify();
}