From: Adeel Kazmi Date: Tue, 16 Jun 2015 12:07:33 +0000 (-0700) Subject: Merge "Make mutex test variables volatile to prevent potential errors cused by optimi... X-Git-Tag: dali_1.0.45~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5829b1d780bbdc667f628856763f2009de83ccf9;hp=46ff27fd5e5f627927c94aee6fc94461c65c05cb;p=platform%2Fcore%2Fuifw%2Fdali-core.git Merge "Make mutex test variables volatile to prevent potential errors cused by optimizer" into devel/master --- diff --git a/automated-tests/src/dali-devel/utc-Dali-Mutex.cpp b/automated-tests/src/dali-devel/utc-Dali-Mutex.cpp index 2911d6c..60fdaaf 100644 --- a/automated-tests/src/dali-devel/utc-Dali-Mutex.cpp +++ b/automated-tests/src/dali-devel/utc-Dali-Mutex.cpp @@ -50,10 +50,11 @@ int UtcDaliMutexSingleThread(void) namespace // for local variables to avoid name clashes { -int gGlobalValue = 0; -Mutex* gGlobalValueMutex; -bool gWorkerThreadWait = true; -enum ThreadState { INIT, RUN, LOCKING, TERMINATE } gWorkerThreadState = INIT; +// make all these volatile to pre-empt any optimization screwing up the logic +volatile int gGlobalValue = 0; +volatile bool gWorkerThreadWait = true; +volatile enum ThreadState { INIT, RUN, LOCKING, TERMINATE } gWorkerThreadState = INIT; +Mutex* volatile gGlobalValueMutex; // volatile pointer to a mutex object } void* WorkerThread1( void* ptr ) {