use errno
This commit is contained in:
@@ -59,7 +59,7 @@ int ThreadImpl_Pthreads::Wait()
|
|||||||
void *val;
|
void *val;
|
||||||
int ret = pthread_join( thread, &val );
|
int ret = pthread_join( thread, &val );
|
||||||
if( ret )
|
if( ret )
|
||||||
RageException::Throw( "pthread_join: %s", strerror(ret) );
|
RageException::Throw( "pthread_join: %s", strerror(errno) );
|
||||||
|
|
||||||
return (int) val;
|
return (int) val;
|
||||||
}
|
}
|
||||||
@@ -111,12 +111,12 @@ ThreadImpl *MakeThread( int (*pFunc)(void *pData), void *pData, uint64_t *piThre
|
|||||||
|
|
||||||
int ret = pthread_create( &thread->thread, NULL, StartThread, thread );
|
int ret = pthread_create( &thread->thread, NULL, StartThread, thread );
|
||||||
if( ret )
|
if( ret )
|
||||||
FAIL_M( ssprintf( "pthread_create: %s", strerror(errno)) );
|
FAIL_M( ssprintf( "MakeThread: pthread_create: %s", strerror(errno)) );
|
||||||
|
|
||||||
/* Don't return until StartThread sets m_piThreadID. */
|
/* Don't return until StartThread sets m_piThreadID. */
|
||||||
ret = sem_wait( &thread->m_StartFinishedSem );
|
ret = sem_wait( &thread->m_StartFinishedSem );
|
||||||
if( ret )
|
if( ret )
|
||||||
FAIL_M( ssprintf( "pthread_create: %s", strerror(errno)) );
|
FAIL_M( ssprintf( "MakeThread: sem_wait: %s", strerror(errno)) );
|
||||||
sem_destroy( &thread->m_StartFinishedSem );
|
sem_destroy( &thread->m_StartFinishedSem );
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
@@ -132,7 +132,7 @@ MutexImpl_Pthreads::~MutexImpl_Pthreads()
|
|||||||
{
|
{
|
||||||
int ret = pthread_mutex_destroy( &mutex ) == -1;
|
int ret = pthread_mutex_destroy( &mutex ) == -1;
|
||||||
if( ret )
|
if( ret )
|
||||||
RageException::Throw( "Error deleting mutex: %s", strerror(ret) );
|
RageException::Throw( "Error deleting mutex: %s", strerror(errno) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ bool MutexImpl_Pthreads::Lock()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FAIL_M( ssprintf("pthread_mutex_timedlock: %s", strerror(ret)) );
|
FAIL_M( ssprintf("pthread_mutex_timedlock: %s", strerror(errno)) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ bool MutexImpl_Pthreads::TryLock()
|
|||||||
if( ret == EBUSY )
|
if( ret == EBUSY )
|
||||||
return false;
|
return false;
|
||||||
if( ret )
|
if( ret )
|
||||||
RageException::Throw( "pthread_mutex_lock failed: %s", strerror(ret) );
|
RageException::Throw( "pthread_mutex_lock failed: %s", strerror(errno) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ bool SemaImpl_Pthreads::Wait()
|
|||||||
}
|
}
|
||||||
while( ret == -1 && errno == EINTR );
|
while( ret == -1 && errno == EINTR );
|
||||||
|
|
||||||
ASSERT_M( ret == 0, ssprintf("sem_wait: %s", strerror(errno)) );
|
ASSERT_M( ret == 0, ssprintf("Wait: sem_wait: %s", strerror(errno)) );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -265,7 +265,7 @@ bool SemaImpl_Pthreads::TryWait()
|
|||||||
if( ret == EBUSY )
|
if( ret == EBUSY )
|
||||||
return false;
|
return false;
|
||||||
if( ret )
|
if( ret )
|
||||||
RageException::Throw( "sem_trywait failed: %s", strerror(ret) );
|
RageException::Throw( "TryWait: sem_trywait failed: %s", strerror(errno) );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user