From 76c6ab7af5a003eb5683523d178df0310b6ef1e4 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 26 Mar 2004 05:47:56 +0000 Subject: [PATCH] fix movie texture crash on signal (eg. suspend) --- .../src/arch/MovieTexture/MovieTexture_FFMpeg.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index 4be0bc46d0..0d685387ec 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -839,12 +839,19 @@ void MovieTexture_FFMpeg::DecoderThread() /* Signal the main thread to update the image on the next Update. */ m_ImageWaiting=true; - CHECKPOINT; - SDL_SemWait( m_BufferFinished ); - CHECKPOINT; + /* SDL_SemWait does not properly retry sem_wait in Linux on EINTR. */ + do + { + CHECKPOINT; + errno = 0; + ret = SDL_SemWait( m_BufferFinished ); + } + while( ret == -1 && errno == EINTR ); + + ASSERT_M( ret != -1, ssprintf("%s, %s", SDL_GetError(), strerror(errno)) ); /* If the frame wasn't used, then we must be shutting down. */ - ASSERT( !m_ImageWaiting || m_State == DECODER_QUIT ); + ASSERT( !m_ImageWaiting || m_State == DECODER_QUIT, ssprintf("%i", m_State) ); } CHECKPOINT; }