[vlc-commits] bin/darwinvlc: readd exit handler for the case the macosx interface is not used

David Fuhrmann git at videolan.org
Wed Feb 12 15:54:50 CET 2014


vlc | branch: master | David Fuhrmann <david.fuhrmann at googlemail.com> | Wed Feb 12 15:51:32 2014 +0100| [b173cc47256e8a21c13ea92f2cc246802024ac9c] | committer: David Fuhrmann

bin/darwinvlc: readd exit handler for the case the macosx interface is not used

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

 bin/darwinvlc.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bin/darwinvlc.c b/bin/darwinvlc.c
index 19d2c58..0a35dc5 100644
--- a/bin/darwinvlc.c
+++ b/bin/darwinvlc.c
@@ -55,6 +55,12 @@ static bool signal_ignored (int signum)
             ? (void *)sa.sa_sigaction : (void *)sa.sa_handler) == SIG_IGN;
 }
 
+static void vlc_kill (void *data)
+{
+    pthread_t *ps = data;
+    pthread_kill (*ps, SIGTERM);
+}
+
 static void exit_timeout (int signum)
 {
     (void) signum;
@@ -204,12 +210,15 @@ int main( int i_argc, const char *ppsz_argv[] )
 
     vlc_enable_override ();
 
+    pthread_t self = pthread_self ();
+
     /* Initialize libvlc */
     libvlc_instance_t *vlc = libvlc_new (argc, argv);
     if (vlc == NULL)
         return 1;
 
     int ret = 1;
+    libvlc_set_exit_handler (vlc, vlc_kill, &self);
     libvlc_set_app_id (vlc, "org.VideoLAN.VLC", PACKAGE_VERSION, PACKAGE_NAME);
     libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION);
 



More information about the vlc-commits mailing list