Commit 16dc3ef6 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: replaced dated threading hacks with the latest season stuff

Thanks to Rémi for the help
parent dfa6e4ce
...@@ -54,9 +54,6 @@ typedef struct intf_thread_t ...@@ -54,9 +54,6 @@ typedef struct intf_thread_t
struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */ struct intf_thread_t *p_next; /** LibVLC interfaces book keeping */
vlc_thread_t thread; /** LibVLC thread */ vlc_thread_t thread; /** LibVLC thread */
/* Thread properties and locks */ /* Thread properties and locks */
#if defined( __APPLE__ )
bool b_should_run_on_first_thread;
#endif
/* Specific interfaces */ /* Specific interfaces */
intf_sys_t * p_sys; /** system interface */ intf_sys_t * p_sys; /** system interface */
......
...@@ -65,6 +65,8 @@ ...@@ -65,6 +65,8 @@
#import <AddressBook/AddressBook.h> /* for crashlog send mechanism */ #import <AddressBook/AddressBook.h> /* for crashlog send mechanism */
#import <Sparkle/Sparkle.h> /* we're the update delegate */ #import <Sparkle/Sparkle.h> /* we're the update delegate */
#include "../../../lib/libvlc_internal.h"
/***************************************************************************** /*****************************************************************************
* Local prototypes. * Local prototypes.
*****************************************************************************/ *****************************************************************************/
...@@ -97,6 +99,7 @@ int OpenIntf ( vlc_object_t *p_this ) ...@@ -97,6 +99,7 @@ int OpenIntf ( vlc_object_t *p_this )
{ {
NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *o_pool = [[NSAutoreleasePool alloc] init];
[VLCApplication sharedApplication]; [VLCApplication sharedApplication];
intf_thread_t *p_intf = (intf_thread_t*) p_this; intf_thread_t *p_intf = (intf_thread_t*) p_this;
p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
...@@ -107,8 +110,9 @@ int OpenIntf ( vlc_object_t *p_this ) ...@@ -107,8 +110,9 @@ int OpenIntf ( vlc_object_t *p_this )
/* subscribe to LibVLCCore's messages */ /* subscribe to LibVLCCore's messages */
vlc_Subscribe( &p_intf->p_sys->sub, MsgCallback, NULL ); 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]; [o_pool release];
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -205,6 +209,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -205,6 +209,8 @@ static void Run( intf_thread_t *p_intf )
[[VLCMain sharedInstance] applicationWillTerminate:nil]; [[VLCMain sharedInstance] applicationWillTerminate:nil];
[o_appLock release]; [o_appLock release];
[o_pool release]; [o_pool release];
raise(SIGTERM);
} }
#pragma mark - #pragma mark -
......
...@@ -108,9 +108,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain ) ...@@ -108,9 +108,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL ); var_AddCallback( p_intf, "intf-add", AddIntfCallback, NULL );
/* Attach interface to LibVLC */ /* Attach interface to LibVLC */
#if defined( __APPLE__ )
p_intf->b_should_run_on_first_thread = false;
#endif
/* Choose the best module */ /* Choose the best module */
p_intf->p_cfg = NULL; p_intf->p_cfg = NULL;
...@@ -130,17 +127,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain ) ...@@ -130,17 +127,6 @@ int intf_Create( vlc_object_t *p_this, const char *chain )
goto error; 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 */ /* Run the interface in a separate thread */
if( p_intf->pf_run if( p_intf->pf_run
&& vlc_clone( &p_intf->thread, && vlc_clone( &p_intf->thread,
......
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