]> git.sesse.net Git - vlc/commitdiff
Win32: get rid of vlc_thread_ready()
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 14 Jan 2009 19:19:54 +0000 (21:19 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 14 Jan 2009 19:20:19 +0000 (21:20 +0200)
By the way, the Win32 video outputs could probably go through some code
factorization. Don't ask me.

modules/gui/wince/wince.cpp
modules/gui/wince/wince.h
modules/video_output/msw/direct3d.c
modules/video_output/msw/directx.c
modules/video_output/msw/events.c
modules/video_output/msw/glwin32.c
modules/video_output/msw/vout.h
modules/video_output/msw/wingdi.c

index 939fa3ea335fa798c4b481495a584c62c7823051..33389cfa3a1e9f86984b1269b8928974de3c8053 100644 (file)
@@ -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 )
index 73580b51c1093d822a452d453ba5d7f71d4774aa..e7ccf3b8f8014a2e7cebbe9b99ff2d041408baee 100644 (file)
@@ -86,6 +86,8 @@ struct intf_sys_t
     vector<MenuItemExt*> *p_settings_menu;
 
     VideoWindow          *p_video_window;
+
+    HANDLE   thread_ready;
 };
 
 /*****************************************************************************
index d27e2b2bae13de0f403e213ab44c8fdadde5cffc..021323b293123e022c4e82e1f6670452e1ea7687 100644 (file)
@@ -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 )
     {
index 654d8425cb67f45c7cda67a7c3656d9dfe00946b..217ffeb434aa545bc461ddf7ea9350c956664758 100644 (file)
@@ -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 )
     {
index b0ec026f4ae74dbab53709d20f77ab9c4c7d5064..35c74f3e414dd4a44e7dc8200c35d4dd43f310ea 100644 (file)
@@ -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 */
index a7d5a09d47b4113daeeaa657ddc9d466d88bbb42..5729a270ca2952d81cb265e87adc861180501805 100644 (file)
@@ -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 )
     {
index 043e77fe801feab1cf9c42164d5f22d0e9b1635e..d1753f11d36b23dbad5b07b4d9aea7d591493c28 100644 (file)
@@ -30,6 +30,7 @@ typedef struct event_thread_t
     VLC_COMMON_MEMBERS
 
     vout_thread_t * p_vout;
+    HANDLE window_ready;
 
 } event_thread_t;
 
index 42416b6d2dafae726db4c30c5c31e1200cf64c5a..190fd90293a6132e9b37eb45d6e555412c675057 100644 (file)
@@ -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 )
     {