typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT) ( HANDLE, HANDLE, DWORD, BOOL );
-typedef struct
-{
- HANDLE mutex;
-} vlc_mutex_t;
+typedef HANDLE vlc_mutex_t;
typedef struct
{
#elif defined( WIN32 )
VLC_UNUSED( psz_file); VLC_UNUSED( i_line );
- WaitForSingleObject( p_mutex->mutex, INFINITE );
+ WaitForSingleObject( *p_mutex, INFINITE );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
acquire_sem( p_mutex->lock );
#elif defined( WIN32 )
VLC_UNUSED( psz_file); VLC_UNUSED( i_line );
- ReleaseMutex( p_mutex->mutex );
+ ReleaseMutex( *p_mutex );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
release_sem( p_mutex->lock );
/* Increase our wait count */
p_condvar->i_waiting_threads++;
- SignalObjectAndWait( p_mutex->mutex, p_condvar->event, INFINITE, FALSE );
+ SignalObjectAndWait( *p_mutex, p_condvar->event, INFINITE, FALSE );
p_condvar->i_waiting_threads--;
/* Reacquire the mutex before returning. */
/* Increase our wait count */
p_condvar->i_waiting_threads++;
- result = SignalObjectAndWait( p_mutex->mutex, p_condvar->event,
+ result = SignalObjectAndWait( *p_mutex, p_condvar->event,
delay_ms, FALSE );
p_condvar->i_waiting_threads--;
return 0;
#elif defined( WIN32 )
- p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
- return ( p_mutex->mutex != NULL ? 0 : 1 );
+ *p_mutex = CreateMutex( 0, FALSE, 0 );
+ return (*p_mutex != NULL) ? 0 : ENOMEM;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
/* check the arguments and whether it's already been initialized */
{
#if defined( WIN32 )
/* Create mutex returns a recursive mutex */
- p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
- return ( p_mutex->mutex != NULL ? 0 : 1 );
+ *p_mutex = CreateMutex( 0, FALSE, 0 );
+ return (*p_mutex != NULL) ? 0 : ENOMEM;
#elif defined( LIBVLC_USE_PTHREAD )
pthread_mutexattr_t attr;
int i_result;
#elif defined( WIN32 )
VLC_UNUSED( psz_file); VLC_UNUSED( i_line );
- CloseHandle( p_mutex->mutex );
+ CloseHandle( *p_mutex );
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if( p_mutex->init == 9999 )
#if defined( HAVE_KERNEL_SCHEDULER_H )
# error Unimplemented!
-#elif defined( UNDER_CE ) || defined( WIN32 )
+#elif defined( UNDER_CE )
#elif defined( WIN32 )
*p_tls = TlsAlloc();
i_ret = (*p_tls == INVALID_HANDLE_VALUE) ? EAGAIN : 0;