[vlc-commits] macosx: replaced dated threading hacks with the latest season stuff

Felix Paul Kühne git at videolan.org
Wed May 9 20:13:00 CEST 2012


vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Wed May  9 20:11:22 2012 +0200| [16dc3ef60af61c0d92631a693bef8ce9e5938462] | committer: Felix Paul Kühne

macosx: replaced dated threading hacks with the latest season stuff

Thanks to Rémi for the help

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16dc3ef60af61c0d92631a693bef8ce9e5938462
---

 include/vlc_interface.h   |    3 ---
 modules/gui/macosx/intf.m |   10 ++++++++--
 src/interface/interface.c |   14 --------------
 3 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/include/vlc_interface.h b/include/vlc_interface.h
index 14898e3..3a4c0aa 100644
--- a/include/vlc_interface.h
+++ b/include/vlc_interface.h
@@ -54,9 +54,6 @@ typedef struct intf_thread_t
     struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
     vlc_thread_t thread; /** LibVLC thread */
     /* Thread properties and locks */
-#if defined( __APPLE__ )
-    bool          b_should_run_on_first_thread;
-#endif
 
     /* Specific interfaces */
     intf_sys_t *        p_sys;                          /** system interface */
diff --git a/modules/gui/macosx/intf.m b/modules/gui/macosx/intf.m
index 90f7c6c..d9b5008 100644
--- a/modules/gui/macosx/intf.m
+++ b/modules/gui/macosx/intf.m
@@ -65,6 +65,8 @@
 #import <AddressBook/AddressBook.h>         /* for crashlog send mechanism */
 #import <Sparkle/Sparkle.h>                 /* we're the update delegate */
 
+#include "../../../lib/libvlc_internal.h"
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -97,6 +99,7 @@ int OpenIntf ( vlc_object_t *p_this )
 {
     NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
     [VLCApplication sharedApplication];
+
     intf_thread_t *p_intf = (intf_thread_t*) p_this;
 
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
@@ -107,8 +110,9 @@ int OpenIntf ( vlc_object_t *p_this )
 
     /* subscribe to LibVLCCore's messages */
     vlc_Subscribe( &p_intf->p_sys->sub, MsgCallback, NULL );
-    p_intf->pf_run = Run;
-    p_intf->b_should_run_on_first_thread = true;
+
+    libvlc_SetExitHandler( p_intf->p_libvlc, vlc_object_kill, p_intf );
+    Run( p_intf );
 
     [o_pool release];
     return VLC_SUCCESS;
@@ -205,6 +209,8 @@ static void Run( intf_thread_t *p_intf )
     [[VLCMain sharedInstance] applicationWillTerminate:nil];
     [o_appLock release];
     [o_pool release];
+
+    raise(SIGTERM);
 }
 
 #pragma mark -
diff --git a/src/interface/interface.c b/src/interface/interface.c
index 8161e86..095de2d 100644
--- a/src/interface/interface.c
+++ b/src/interface/interface.c
@@ -108,9 +108,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
     var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL );
 
     /* Attach interface to LibVLC */
-#if defined( __APPLE__ )
-    p_intf->b_should_run_on_first_thread = false;
-#endif
 
     /* Choose the best module */
     p_intf->p_cfg = NULL;
@@ -130,17 +127,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
         goto error;
     }
 
-#if defined( __APPLE__ )
-    /* Hack to get Mac OS X Cocoa runtime running
-     * (it needs access to the main thread) */
-    if( p_intf->b_should_run_on_first_thread )
-    {
-        libvlc_SetExitHandler( p_libvlc, vlc_object_kill, p_intf );
-        assert( p_intf->pf_run );
-        p_intf->pf_run( p_intf );
-        p_intf->pf_run = NULL;
-    }
-#endif
     /* Run the interface in a separate thread */
     if( p_intf->pf_run
      && vlc_clone( &p_intf->thread,



More information about the vlc-commits mailing list