int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_acquire( &p_mutex->mutex, FALSE, NULL ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_mutex->p_this,
- "thread %li: mutex_lock failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: mutex_lock failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_mutex_release( &p_mutex->mutex ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_mutex->p_this,
- "thread %li: mutex_unlock failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: mutex_unlock failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_notify( &p_condvar->cond, FALSE ) == FALSE );
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_signal failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: cond_signal failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
int i_result;
/* In case of error : */
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
i_result = ( pth_cond_await( &p_condvar->cond, &p_mutex->mutex, NULL )
if( i_result == ETIMEDOUT )
{
+ errno = ETIMEDOUT;
msg_Dbg( p_condvar->p_this,
"thread %li: possible condition deadlock "
- "at %s:%d (%s)", CAST_PTHREAD_TO_INT(pthread_self()),
- psz_file, i_line, strerror(i_result) );
+ "at %s:%d (%m)", CAST_PTHREAD_TO_INT(pthread_self()),
+ psz_file, i_line );
i_result = pthread_cond_wait( &p_condvar->cond, &p_mutex->mutex );
}
if ( i_result )
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_result);
+ errno = i_result;
}
#elif defined( HAVE_CTHREADS_H )
if( i_result )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_wait failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %li: cond_wait failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
{
int i_res;
unsigned long int i_thread = 0;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
# error Unimplemented
if ( i_res ) /* other errors = bug */
{
i_thread = CAST_PTHREAD_TO_INT(pthread_self());
- psz_error = strerror(i_res);
+ errno = i_res;
}
#elif defined( HAVE_CTHREADS_H )
if( i_res )
{
msg_Err( p_condvar->p_this,
- "thread %li: cond_wait failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_res, psz_error );
+ "thread %li: cond_wait failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_res );
}
return i_res;