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

Fix use of vlc_object_wait()

parent 82580b6f
...@@ -124,6 +124,7 @@ static unsigned __stdcall IPCHelperThread( void * ); ...@@ -124,6 +124,7 @@ static unsigned __stdcall IPCHelperThread( void * );
LRESULT CALLBACK WMCOPYWNDPROC( HWND, UINT, WPARAM, LPARAM ); LRESULT CALLBACK WMCOPYWNDPROC( HWND, UINT, WPARAM, LPARAM );
static vlc_object_t *p_helper = NULL; static vlc_object_t *p_helper = NULL;
static unsigned long hIPCHelper; static unsigned long hIPCHelper;
static HANDLE hIPCHelperReady;
typedef struct typedef struct
{ {
...@@ -177,16 +178,14 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv ...@@ -177,16 +178,14 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
p_helper = p_helper =
vlc_custom_create( p_this, sizeof(vlc_object_t), vlc_custom_create( p_this, sizeof(vlc_object_t),
VLC_OBJECT_GENERIC, typename ); VLC_OBJECT_GENERIC, typename );
vlc_object_lock( p_helper );
/* Run the helper thread */ /* Run the helper thread */
hIPCHelperReady = CreateEvent( NULL, FALSE, FALSE, NULL );
hIPCHelper = _beginthreadex( NULL, 0, IPCHelperThread, p_helper, hIPCHelper = _beginthreadex( NULL, 0, IPCHelperThread, p_helper,
0, NULL ); 0, NULL );
if( hIPCHelper ) if( hIPCHelper )
vlc_object_wait( p_helper ); WaitForSingleObject( hIPCHelperReady, INFINITE );
vlc_object_unlock( p_helper ); else
if( !hIPCHelper )
{ {
msg_Err( p_this, "one instance mode DISABLED " msg_Err( p_this, "one instance mode DISABLED "
"(IPC helper thread couldn't be created)" ); "(IPC helper thread couldn't be created)" );
...@@ -194,6 +193,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv ...@@ -194,6 +193,7 @@ void system_Configure( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv
p_helper = NULL; p_helper = NULL;
} }
vlc_object_attach (p_helper, p_this); vlc_object_attach (p_helper, p_this);
CloseHandle( hIPCHelperReady );
/* Initialization done. /* Initialization done.
* Release the mutex to unblock other instances */ * Release the mutex to unblock other instances */
...@@ -292,7 +292,7 @@ static unsigned __stdcall IPCHelperThread( void *data ) ...@@ -292,7 +292,7 @@ static unsigned __stdcall IPCHelperThread( void *data )
SetWindowLongPtr( ipcwindow, GWLP_USERDATA, (LONG_PTR)p_this ); SetWindowLongPtr( ipcwindow, GWLP_USERDATA, (LONG_PTR)p_this );
/* Signal the creation of the thread and events queue */ /* Signal the creation of the thread and events queue */
vlc_object_signal( p_this ); SetEvent( hIPCHelperReady );
while( GetMessage( &message, NULL, 0, 0 ) ) while( GetMessage( &message, NULL, 0, 0 ) )
{ {
......
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