From 3cd26abb992d2241e5fff580e089cfe5da7cf271 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Sun, 5 Feb 2006 13:24:44 +0000 Subject: [PATCH] Just in case these are ever implemented, fix. sem_* return -1 for all error conditions. Only sem_destroy sets errno to EBUSY anway. Also, ASSERT so we get a backtrace. --- stepmania/src/arch/Threads/Threads_Pthreads.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stepmania/src/arch/Threads/Threads_Pthreads.cpp b/stepmania/src/arch/Threads/Threads_Pthreads.cpp index dec054038c..a73f99073a 100644 --- a/stepmania/src/arch/Threads/Threads_Pthreads.cpp +++ b/stepmania/src/arch/Threads/Threads_Pthreads.cpp @@ -301,10 +301,11 @@ bool SemaImpl_Pthreads::Wait() bool SemaImpl_Pthreads::TryWait() { int ret = sem_trywait( &sem ); - if( ret == EBUSY ) + if( ret == -1 && errno == EAGAIN ) return false; - if( ret ) - RageException::Throw( "TryWait: sem_trywait failed: %s", strerror(errno) ); + + ASSERT_M( ret == 0, ssprintf("TryWait: sem_trywait failed: %s", strerror(errno)) ); + return true; } #else