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.
This commit is contained in:
Steve Checkoway
2006-02-05 13:24:44 +00:00
parent 79218ae6ad
commit 3cd26abb99
@@ -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