[vlc-devel] commit: Win32: get rid of vlc_thread_ready() ( Rémi Denis-Courmont )
git version control
git at videolan.org
Wed Jan 14 20:22:32 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Jan 14 21:19:54 2009 +0200| [db37d62c16bf75313f56ab36dbdb670c1f26e7b3] | committer: Rémi Denis-Courmont
Win32: get rid of vlc_thread_ready()
By the way, the Win32 video outputs could probably go through some code
factorization. Don't ask me.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=db37d62c16bf75313f56ab36dbdb670c1f26e7b3
---
modules/gui/wince/wince.cpp | 8 ++++++--
modules/gui/wince/wince.h | 2 ++
modules/video_output/msw/direct3d.c | 6 +++++-
modules/video_output/msw/directx.c | 6 +++++-
modules/video_output/msw/events.c | 2 +-
modules/video_output/msw/glwin32.c | 6 +++++-
modules/video_output/msw/vout.h | 1 +
modules/video_output/msw/wingdi.c | 8 ++++++--
8 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/modules/gui/wince/wince.cpp b/modules/gui/wince/wince.cpp
index 939fa3e..33389cf 100644
--- a/modules/gui/wince/wince.cpp
+++ b/modules/gui/wince/wince.cpp
@@ -191,12 +191,16 @@ static void Run( intf_thread_t *p_intf )
/* The module is used in dialog provider mode */
/* Create a new thread for the dialogs provider */
+ p_intf->p_sys->thread_ready = CreateEvent (NULL, TRUE, FALSE, NULL);
if( vlc_thread_create( p_intf, "WinCE Dialogs Thread",
- MainLoop, 0, true ) )
+ MainLoop, 0, false ) )
{
msg_Err( p_intf, "cannot create WinCE Dialogs Thread" );
p_intf->pf_show_dialog = NULL;
}
+ else
+ WaitForSingleObject (p_priv->thread_ready, INFINITE);
+ CloseHandle (p_priv->thread_ready);
}
else
{
@@ -252,7 +256,7 @@ static void* MainLoop( vlc_object_t * p_this )
p_intf->p_sys->pf_show_dialog = ShowDialog;
/* OK, initialization is over */
- vlc_thread_ready( p_intf );
+ SetEvent( p_intf->p_sys->thread_ready );
// Main message loop
while( GetMessage( &msg, NULL, 0, 0 ) > 0 )
diff --git a/modules/gui/wince/wince.h b/modules/gui/wince/wince.h
index 73580b5..e7ccf3b 100644
--- a/modules/gui/wince/wince.h
+++ b/modules/gui/wince/wince.h
@@ -86,6 +86,8 @@ struct intf_sys_t
vector<MenuItemExt*> *p_settings_menu;
VideoWindow *p_video_window;
+
+ HANDLE thread_ready;
};
/*****************************************************************************
diff --git a/modules/video_output/msw/direct3d.c b/modules/video_output/msw/direct3d.c
index d27e2b2..021323b 100644
--- a/modules/video_output/msw/direct3d.c
+++ b/modules/video_output/msw/direct3d.c
@@ -203,14 +203,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
+ p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
- EventThread, 0, 1 ) )
+ EventThread, 0, false ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
+ CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
+ WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
+ CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error )
{
diff --git a/modules/video_output/msw/directx.c b/modules/video_output/msw/directx.c
index 654d842..217ffeb 100644
--- a/modules/video_output/msw/directx.c
+++ b/modules/video_output/msw/directx.c
@@ -277,14 +277,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
+ p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
- EventThread, 0, 1 ) )
+ EventThread, 0, false ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
+ CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
+ WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
+ CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error )
{
diff --git a/modules/video_output/msw/events.c b/modules/video_output/msw/events.c
index b0ec026..35c74f3 100644
--- a/modules/video_output/msw/events.c
+++ b/modules/video_output/msw/events.c
@@ -121,7 +121,7 @@ void* EventThread( vlc_object_t *p_this )
}
/* Signal the creation of the window */
- vlc_thread_ready( p_event );
+ SetEvent( p_event->window_ready );
#ifndef UNDER_CE
/* Set power management stuff */
diff --git a/modules/video_output/msw/glwin32.c b/modules/video_output/msw/glwin32.c
index a7d5a09..5729a27 100644
--- a/modules/video_output/msw/glwin32.c
+++ b/modules/video_output/msw/glwin32.c
@@ -134,14 +134,18 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
+ p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
- EventThread, 0, 1 ) )
+ EventThread, 0, false ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
+ CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
+ WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
+ CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error )
{
diff --git a/modules/video_output/msw/vout.h b/modules/video_output/msw/vout.h
index 043e77f..d1753f1 100644
--- a/modules/video_output/msw/vout.h
+++ b/modules/video_output/msw/vout.h
@@ -30,6 +30,7 @@ typedef struct event_thread_t
VLC_COMMON_MEMBERS
vout_thread_t * p_vout;
+ HANDLE window_ready;
} event_thread_t;
diff --git a/modules/video_output/msw/wingdi.c b/modules/video_output/msw/wingdi.c
index 42416b6..190fd90 100644
--- a/modules/video_output/msw/wingdi.c
+++ b/modules/video_output/msw/wingdi.c
@@ -242,14 +242,18 @@ static int OpenVideo ( vlc_object_t *p_this )
p_vout->p_sys->p_event =
vlc_object_create( p_vout, sizeof(event_thread_t) );
p_vout->p_sys->p_event->p_vout = p_vout;
- if( vlc_thread_create( p_vout->p_sys->p_event, "VLC Vout Events Thread",
- EventThread, 0, 1 ) )
+ p_vout->p_sys->p_event->ready = CreateEvent( NULL, TRUE, FALSE, NULL );
+ if( vlc_thread_create( p_vout->p_sys->p_event, "Vout Events Thread",
+ EventThread, 0, false ) )
{
msg_Err( p_vout, "cannot create Vout EventThread" );
+ CloseHandle( p_vout->p_sys->p_event->ready );
vlc_object_release( p_vout->p_sys->p_event );
p_vout->p_sys->p_event = NULL;
goto error;
}
+ WaitForSingleObject( p_vout->p_sys->p_event->ready, INFINITE )
+ CloseHandle( p_vout->p_sys->p_event->ready );
if( p_vout->p_sys->p_event->b_error )
{
More information about the vlc-devel
mailing list