From 5508ece5377c75154067c8203e31a12d154a2ec0 Mon Sep 17 00:00:00 2001 From: Wonsik Jung Date: Mon, 8 Feb 2021 19:13:26 +0900 Subject: [PATCH] Fix the race condition issue of RenderOnce() in GlWindow Fix the race condition issue of RenderOnce() in GlWindow. If RenderOnce() function is called in event thread continuously, the race condition issue will be occured. Because the renderOnce flag is written in event thread and the flag is read and written in render thread without lock. This patch is to fix the issue. Change-Id: I0a45c0e538c19b9c552d75fd1cf1e2ca4cbd042a --- dali/internal/window-system/common/gl-window-render-thread.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dali/internal/window-system/common/gl-window-render-thread.cpp b/dali/internal/window-system/common/gl-window-render-thread.cpp index 783ff36..55010ce 100644 --- a/dali/internal/window-system/common/gl-window-render-thread.cpp +++ b/dali/internal/window-system/common/gl-window-render-thread.cpp @@ -130,6 +130,7 @@ void GlWindowRenderThread::SetOnDemandRenderMode(bool onDemand) void GlWindowRenderThread::RenderOnce() { + // Most of all, this function is called in event thread ConditionalWait::ScopedLock lock(mRenderThreadWaitCondition); mRequestRenderOnce = 1; mRenderThreadWaitCondition.Notify(lock); @@ -188,11 +189,6 @@ void GlWindowRenderThread::Run() } TimeService::SleepUntil(timeToSleepUntil); - - if(mRequestRenderOnce) - { - mRequestRenderOnce = 0; - } } if(mGLTerminateCallback) @@ -263,6 +259,7 @@ bool GlWindowRenderThread::RenderReady(uint64_t& timeToSleepUntil) mRenderThreadWaitCondition.Wait(updateLock); } + mRequestRenderOnce = 0; // Keep the update-render thread alive if this thread is NOT to be destroyed return !mDestroyRenderThread; } -- 2.7.4