don't throw in thread setup
This commit is contained in:
@@ -95,7 +95,6 @@ static void *StartThread( void *pData )
|
|||||||
|
|
||||||
*pThis->m_piThreadID = pThis->GetThreadId();
|
*pThis->m_piThreadID = pThis->GetThreadId();
|
||||||
|
|
||||||
fprintf(stderr, "set %i\n", (int) pThis->GetThreadId() );
|
|
||||||
/* Tell MakeThread that we've set m_piThreadID, so it's safe to return. */
|
/* Tell MakeThread that we've set m_piThreadID, so it's safe to return. */
|
||||||
sem_post( &pThis->m_StartFinishedSem );
|
sem_post( &pThis->m_StartFinishedSem );
|
||||||
|
|
||||||
@@ -112,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 )
|
||||||
RageException::Throw( "pthread_create: %s", strerror(ret) );
|
FAIL_M( ssprintf( "pthread_create: %s", strerror(ret)) );
|
||||||
|
|
||||||
/* 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 )
|
||||||
RageException::Throw( "MakeThread(): sem_wait: %s", strerror(ret) );
|
FAIL_M( ssprintf( "pthread_create: %s", strerror(ret)) );
|
||||||
sem_destroy( &thread->m_StartFinishedSem );
|
sem_destroy( &thread->m_StartFinishedSem );
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
|
|||||||
Reference in New Issue
Block a user