From 42ae4367c2775737ff270f90b56968e80c4331a3 Mon Sep 17 00:00:00 2001 From: foreman Date: Wed, 15 Oct 2014 17:49:44 -0400 Subject: [PATCH] P4 to Git Change 1087847 by lmoriche@lmoriche_opencl_dev on 2014/10/15 17:33:42 EPR #407144 - Fixes an issue introduced by CL#1082950 Affected files ... ... //depot/stg/opencl/drivers/opencl/runtime/thread/semaphore.cpp#8 edit --- rocclr/runtime/thread/semaphore.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rocclr/runtime/thread/semaphore.cpp b/rocclr/runtime/thread/semaphore.cpp index a9e22e011d..235ca45d9a 100644 --- a/rocclr/runtime/thread/semaphore.cpp +++ b/rocclr/runtime/thread/semaphore.cpp @@ -43,12 +43,14 @@ Semaphore::~Semaphore() void Semaphore::post() { - int state = state_; + int state = state_.load(std::memory_order_relaxed); for (;;) { if (state > 0) { - if (state == state_.load(std::memory_order_acquire)) { + int newstate = state_.load(std::memory_order_acquire); + if (state == newstate) { return; } + state = newstate; continue; } if (state_.compare_exchange_weak(state, state+1,