Commit b648be13 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: don't use spin locks^W^Wfast mutexes instead of mutexes

parent 463b756d
...@@ -51,13 +51,6 @@ static vlc_object_t *p_root; ...@@ -51,13 +51,6 @@ static vlc_object_t *p_root;
#if defined( UNDER_CE ) #if defined( UNDER_CE )
#elif defined( WIN32 ) #elif defined( WIN32 )
/*
** On Windows NT/2K/XP we use a slow mutex implementation but which
** allows us to correctly implement condition variables.
** You can also use the faster Win9x implementation but you might
** experience problems with it.
*/
static bool b_fast_mutex = false;
/* /*
** On Windows 9x/Me you can use a fast but incorrect condition variables ** On Windows 9x/Me you can use a fast but incorrect condition variables
** implementation (more precisely there is a possibility for a race ** implementation (more precisely there is a possibility for a race
...@@ -146,7 +139,6 @@ int __vlc_threads_init( vlc_object_t *p_this ) ...@@ -146,7 +139,6 @@ int __vlc_threads_init( vlc_object_t *p_this )
if( IsDebuggerPresent() ) if( IsDebuggerPresent() )
{ {
/* SignalObjectAndWait() is problematic under a debugger */ /* SignalObjectAndWait() is problematic under a debugger */
b_fast_mutex = true;
i_win9x_cv = 1; i_win9x_cv = 1;
} }
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
...@@ -253,17 +245,8 @@ int __vlc_mutex_init( vlc_mutex_t *p_mutex ) ...@@ -253,17 +245,8 @@ int __vlc_mutex_init( vlc_mutex_t *p_mutex )
return 0; return 0;
#elif defined( WIN32 ) #elif defined( WIN32 )
if( !b_fast_mutex )
{
p_mutex->mutex = CreateMutex( 0, FALSE, 0 ); p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
return ( p_mutex->mutex != NULL ? 0 : 1 ); return ( p_mutex->mutex != NULL ? 0 : 1 );
}
else
{
p_mutex->mutex = NULL;
InitializeCriticalSection( &p_mutex->csection );
return 0;
}
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
/* check the arguments and whether it's already been initialized */ /* check the arguments and whether it's already been initialized */
...@@ -392,8 +375,6 @@ int __vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -392,8 +375,6 @@ int __vlc_cond_init( vlc_cond_t *p_condvar )
/* Misc init */ /* Misc init */
p_condvar->i_win9x_cv = i_win9x_cv; p_condvar->i_win9x_cv = i_win9x_cv;
if( !b_fast_mutex || p_condvar->i_win9x_cv == 0 )
{
/* Create an auto-reset event. */ /* Create an auto-reset event. */
p_condvar->event = CreateEvent( NULL, /* no security */ p_condvar->event = CreateEvent( NULL, /* no security */
FALSE, /* auto-reset event */ FALSE, /* auto-reset event */
...@@ -402,25 +383,6 @@ int __vlc_cond_init( vlc_cond_t *p_condvar ) ...@@ -402,25 +383,6 @@ int __vlc_cond_init( vlc_cond_t *p_condvar )
p_condvar->semaphore = NULL; p_condvar->semaphore = NULL;
return !p_condvar->event; return !p_condvar->event;
}
else
{
p_condvar->semaphore = CreateSemaphore( NULL, /* no security */
0, /* initial count */
0x7fffffff, /* max count */
NULL ); /* unnamed */
if( p_condvar->i_win9x_cv == 1 )
/* Create a manual-reset event initially signaled. */
p_condvar->event = CreateEvent( NULL, TRUE, TRUE, NULL );
else
/* Create a auto-reset event. */
p_condvar->event = CreateEvent( NULL, FALSE, FALSE, NULL );
InitializeCriticalSection( &p_condvar->csection );
return !p_condvar->semaphore || !p_condvar->event;
}
#elif defined( HAVE_KERNEL_SCHEDULER_H ) #elif defined( HAVE_KERNEL_SCHEDULER_H )
if( !p_condvar ) if( !p_condvar )
......
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