mVSyncThreadStop( FALSE ),
mRenderThreadStop( FALSE ),
mRenderThreadReplacingSurface( FALSE ),
- mRenderThreadSurfaceRendered( FALSE ),
+ mRenderThreadPostRendering( FALSE ),
mEventThreadSurfaceReplaced( FALSE ),
mVSyncThreadInitialised( FALSE ),
mRenderThreadInitialised( FALSE ),
{
ConditionalWait::ScopedLock lock( mRenderThreadWaitCondition );
- mRenderThreadSurfaceRendered = TRUE;
+ mRenderThreadPostRendering = FALSE;
}
mRenderThreadWaitCondition.Notify();
}
LOG_RENDER_TRACE;
ConditionalWait::ScopedLock lock( mRenderThreadWaitCondition );
- mRenderThreadSurfaceRendered = FALSE;
+ mRenderThreadPostRendering = TRUE;
}
void ThreadSynchronization::PostRenderWaitForCompletion()
LOG_RENDER_TRACE;
ConditionalWait::ScopedLock lock( mRenderThreadWaitCondition );
- if( !mRenderThreadSurfaceRendered &&
- !mRenderThreadReplacingSurface )
+ while( mRenderThreadPostRendering &&
+ ! mRenderThreadReplacingSurface ) // We should NOT wait if we're replacing the surface
{
LOG_RENDER( "WAIT" );
mRenderThreadWaitCondition.Wait( lock );
volatile unsigned int mRenderThreadStop; ///< Whether the render-thread should be stopped (set by the update-thread, read by the render-thread).
volatile unsigned int mRenderThreadReplacingSurface;///< Whether the render-thread should replace the surface (set by the event & render threads, read by the render-thread).
- volatile unsigned int mRenderThreadSurfaceRendered; ///< Whether the render-surface has rendered our surface (set by the event & render threads, read by the render-thread).
+ volatile unsigned int mRenderThreadPostRendering; ///< Whether post-rendering is taking place (set by the event & render threads, read by the render-thread).
volatile unsigned int mEventThreadSurfaceReplaced; ///< Checked by the event-thread & set by the render-thread when the surface has been replaced (set by the event & render threads, read by the event-thread).