X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fminimal_macosx%2Fintf.m;h=e31ebb91b263200f232ea1c81f36d09d64abc837;hb=a11c642f29bf4f163551d2aece30ff01b329321c;hp=d42ecbdb2296802c485fc20a397a93e6a95ca20f;hpb=b394e8e711d9e0f90d0b4b13353ead8b43bd9621;p=vlc diff --git a/modules/gui/minimal_macosx/intf.m b/modules/gui/minimal_macosx/intf.m index d42ecbdb22..e31ebb91b2 100644 --- a/modules/gui/minimal_macosx/intf.m +++ b/modules/gui/minimal_macosx/intf.m @@ -7,7 +7,7 @@ * Authors: Jon Lech Johansen * Christophe Massiot * Derk-Jan Hartman - * Felix KŸhne + * Felix Kühne * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,8 @@ #include #include +#import +#include "../../../lib/libvlc_internal.h" #import @@ -57,13 +59,13 @@ int OpenIntf ( vlc_object_t *p_this ) p_intf->p_sys = malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) { - return( 1 ); + return VLC_ENOMEM; } memset( p_intf->p_sys, 0, sizeof( *p_intf->p_sys ) ); - 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 ); return VLC_SUCCESS; } @@ -98,12 +100,18 @@ static void * KillerThread( void *user_data ) intf_thread_t *p_intf = user_data; - vlc_object_lock ( p_intf ); + vlc_mutex_init( &p_intf->p_sys->lock ); + vlc_cond_init( &p_intf->p_sys->wait ); + + vlc_mutex_lock ( &p_intf->p_sys->lock ); while( vlc_object_alive( p_intf ) ) - vlc_object_wait( p_intf ); - vlc_object_unlock( p_intf ); + vlc_cond_wait( &p_intf->p_sys->wait, &p_intf->p_sys->lock ); + vlc_mutex_unlock( &p_intf->p_sys->lock ); + + vlc_mutex_destroy( &p_intf->p_sys->lock ); + vlc_cond_destroy( &p_intf->p_sys->wait ); - msg_Dbg( p_intf, "Killing the Mac OS X module" ); + msg_Dbg( p_intf, "Killing the Minimal Mac OS X module" ); /* We are dead, terminate */ [NSApp terminate: nil]; @@ -118,11 +126,6 @@ static void Run( intf_thread_t *p_intf ) { sigset_t set; - /* Do it again - for some unknown reason, vlc_thread_create() often - * fails to go to real-time priority with the first launched thread - * (???) --Meuuh */ - vlc_thread_set_priority( p_intf, VLC_THREAD_PRIORITY_LOW ); - /* Make sure the "force quit" menu item does quit instantly. * VLC overrides SIGTERM which is sent by the "force quit" * menu item to make sure deamon mode quits gracefully, so