Commit 51794c7a authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

misc/threads.c: On non-linux create a PTHREAD_MUTEX_ERRORCHECK...

parent da8425f9
...@@ -296,7 +296,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex ) ...@@ -296,7 +296,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
return B_OK; return B_OK;
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H ) #elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
# if defined(DEBUG) && defined(SYS_LINUX) # if defined(DEBUG)
# if defined(SYS_LINUX)
{ {
/* Create error-checking mutex to detect problems more easily. */ /* Create error-checking mutex to detect problems more easily. */
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
...@@ -308,7 +309,20 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex ) ...@@ -308,7 +309,20 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
pthread_mutexattr_destroy( &attr ); pthread_mutexattr_destroy( &attr );
return( i_result ); 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 );
i_result = pthread_mutex_init( &p_mutex->mutex, &attr );
pthread_mutexattr_destroy( &attr );
return( i_result );
}
# endif # endif
# endif
return pthread_mutex_init( &p_mutex->mutex, NULL ); return pthread_mutex_init( &p_mutex->mutex, NULL );
#elif defined( HAVE_CTHREADS_H ) #elif defined( HAVE_CTHREADS_H )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment