Commit 886080d9 authored by Gildas Bazin's avatar Gildas Bazin

* include/threads.h,include/threads_funcs.h: reverted Win32 pthread implementation to
the old code. Fixed vlc_cond_broadcast() for WinNT/2K/XP. Additional vlc_cond_*
implementations for Win9x.
* src/interface/main.c: renamed --fast_pthread option into --fast-mutex. Added a
--win9x-cv-method option to choose which vlc_cond_* implementation we want on Win9x.
parent 1d050f96
......@@ -3,7 +3,7 @@
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: threads.h,v 1.42.2.1 2002/06/17 08:37:56 sam Exp $
* $Id: threads.h,v 1.42.2.2 2002/07/29 16:12:24 gbazin Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -114,14 +114,12 @@ typedef struct
typedef struct
{
int i_waiting_threads;
volatile int i_waiting_threads;
/* WinNT/2K/XP implementation */
HANDLE semaphore;
HANDLE signal;
boolean_t b_broadcast;
HANDLE event;
/* Win95/98/ME implementation */
enum { SIGNAL = 0, BROADCAST = 1 };
HANDLE p_events[2];
HANDLE semaphore;
CRITICAL_SECTION csection;
} vlc_cond_t;
typedef unsigned (__stdcall *PTHREAD_START) (void *);
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* win32_specific.h: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.h,v 1.2 2002/04/02 23:43:57 gbazin Exp $
* $Id: win32_specific.h,v 1.2.2.1 2002/07/29 16:12:24 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -36,6 +36,7 @@ typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT)( HANDLE, HANDLE, DWORD, BOOL );
typedef struct main_sys_s
{
SIGNALOBJECTANDWAIT SignalObjectAndWait;
boolean_t b_fast_pthread;
boolean_t b_fast_mutex;
int i_win9x_cv;
} main_sys_t;
......@@ -4,7 +4,7 @@
* and spawn threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: main.c,v 1.195.2.4 2002/07/19 21:14:40 massiot Exp $
* $Id: main.c,v 1.195.2.5 2002/07/29 16:12:24 gbazin Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -337,11 +337,23 @@
#define DEMUX_LONGTEXT N_( \
"This is a legacy entry to let you configure demux modules")
#define FAST_PTHREAD_TEXT N_("fast pthread on NT/2K/XP (developpers only)")
#define FAST_PTHREAD_LONGTEXT N_( \
"On Windows NT/2K/XP we use a slow but correct pthread implementation, " \
"you can also use this faster implementation but you might experience " \
"problems with it.")
#define FAST_MUTEX_TEXT N_("fast mutex on NT/2K/XP (developpers only)")
#define FAST_MUTEX_LONGTEXT N_( \
"On Windows NT/2K/XP we use a slow mutex implementation but which " \
"allows us to correctely implement condition variables. " \
"You can also use the faster Win9x implementation but you might " \
"experience problems with it.")
#define WIN9X_CV_TEXT N_("Condition variables implementation for Win9x " \
"(developpers only)")
#define WIN9X_CV_LONGTEXT N_( \
"On Windows 9x/Me we use a fast but not correct condition variables " \
"implementation (more precisely there is a possibility for a race " \
"condition to happen). " \
"However it is possible to use slower alternatives which should be more " \
"robust. " \
"Currently you can choose between implementation 0 (which is the " \
"default and the fastest), 1 and 2.")
/*
* Quick usage guide for the configuration options:
......@@ -436,7 +448,8 @@ ADD_MODULE ( "access", MODULE_CAPABILITY_ACCESS, NULL, NULL, ACCESS_TEXT, ACCES
ADD_MODULE ( "demux", MODULE_CAPABILITY_DEMUX, NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT )
#if defined(WIN32)
ADD_BOOL ( "fast_pthread", 0, NULL, FAST_PTHREAD_TEXT, FAST_PTHREAD_LONGTEXT )
ADD_BOOL ( "fast-mutex", 0, NULL, FAST_MUTEX_TEXT, FAST_MUTEX_LONGTEXT )
ADD_INTEGER ( "win9x-cv-method", 0, NULL, WIN9X_CV_TEXT, WIN9X_CV_LONGTEXT )
#endif
MODULE_CONFIG_STOP
......
......@@ -2,7 +2,7 @@
* win32_specific.c: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.c,v 1.7 2002/04/27 22:11:22 gbazin Exp $
* $Id: win32_specific.c,v 1.7.2.1 2002/07/29 16:12:24 gbazin Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -49,9 +49,16 @@ void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
}
/* dynamically get the address of SignalObjectAndWait */
hInstLib = LoadLibrary( "kernel32" );
p_main->p_sys->SignalObjectAndWait =
(SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib, "SignalObjectAndWait" );
if( (GetVersion() < 0x80000000) )
{
/* We are running on NT/2K/XP, we can use SignalObjectAndWait */
hInstLib = LoadLibrary( "kernel32" );
if( hInstLib)
p_main->p_sys->SignalObjectAndWait =
(SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib,
"SignalObjectAndWait" );
}
else p_main->p_sys->SignalObjectAndWait = NULL;
/* WinSock Library Init. */
i_err = WSAStartup( MAKEWORD( 1, 1 ), &Data );
......@@ -69,7 +76,8 @@ void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
*****************************************************************************/
void system_Configure( void )
{
p_main->p_sys->b_fast_pthread = config_GetIntVariable( "fast_pthread" );
p_main->p_sys->b_fast_mutex = config_GetIntVariable( "fast-mutex" );
p_main->p_sys->i_win9x_cv = config_GetIntVariable( "win9x-cv-method" );
}
/*****************************************************************************
......
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