#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# if defined(DEBUG)
-# if defined(SYS_LINUX)
{
/* Create error-checking mutex to detect problems more easily. */
pthread_mutexattr_t attr;
int i_result;
pthread_mutexattr_init( &attr );
+# if defined(SYS_LINUX)
pthread_mutexattr_setkind_np( &attr, PTHREAD_MUTEX_ERRORCHECK_NP );
- i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
- pthread_mutexattr_destroy( &attr );
- return( i_result );
- }
# else
- {
- /* Create error-checking mutex to detect problems more easily. */
- pthread_mutexattr_t attr;
- int i_result;
-
- pthread_mutexattr_init( &attr );
pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_ERRORCHECK );
+# endif
i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
pthread_mutexattr_destroy( &attr );
return( i_result );
}
-# endif
# endif
return pthread_mutex_init( &p_mutex->mutex, NULL );
int i_result;
/* In case of error : */
int i_thread = -1;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
return 0;
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 %d: mutex_destroy failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %d: mutex_destroy failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
int i_result;
/* In case of error : */
int i_thread = -1;
- const char * psz_error = "";
#if defined( PTH_INIT_IN_PTH_H )
return 0;
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 %d: cond_destroy failed at %s:%d (%d:%s)",
- i_thread, psz_file, i_line, i_result, psz_error );
+ "thread %d: cond_destroy failed at %s:%d (%d:%m)",
+ i_thread, psz_file, i_line, i_result );
}
return i_result;
}
if( (i_error = pthread_setschedparam( p_priv->thread_id,
i_policy, ¶m )) )
{
- msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
- psz_file, i_line, strerror(i_error) );
+ errno = i_error;
+ msg_Warn( p_this, "couldn't set thread priority (%s:%d): %m",
+ psz_file, i_line );
i_priority = 0;
}
}
}
else
{
- msg_Err( p_this, "%s thread could not be created at %s:%d (%s)",
- psz_name, psz_file, i_line, strerror(i_ret) );
+ errno = i_ret;
+ msg_Err( p_this, "%s thread could not be created at %s:%d (%m)",
+ psz_name, psz_file, i_line );
vlc_mutex_unlock( &p_this->object_lock );
}
if( (i_error = pthread_setschedparam( p_priv->thread_id,
i_policy, ¶m )) )
{
- msg_Warn( p_this, "couldn't set thread priority (%s:%d): %s",
- psz_file, i_line, strerror(i_error) );
+ errno = i_error;
+ msg_Warn( p_this, "couldn't set thread priority (%s:%d): %m",
+ psz_file, i_line );
i_priority = 0;
}
}
if( i_ret )
{
- msg_Err( p_this, "thread_join(%u) failed at %s:%d (%s)",
- (unsigned int)p_priv->thread_id, psz_file, i_line,
- strerror(i_ret) );
+ errno = i_ret;
+ msg_Err( p_this, "thread_join(%u) failed at %s:%d (%m)",
+ (unsigned int)p_priv->thread_id, psz_file, i_line );
}
else
{