[vorbis-dev] SIGTERM handler for ogg123

Nathan Straz nstraz at sgi.com
Mon Jun 16 14:52:37 PDT 2003



Here is a patch to make ogg123 gracefully exit when it receives a
SIGTERM.  My playlist manager (moosic) sends this signal to the player
when it skips songs.  Without this handler the parent ogg123 thread
exits before it's children, which leaves the sound device locked while
the playlist manager tries to play the next song.

<p>--- vorbis-tools-1.0.0.orig/ogg123/ogg123.c
+++ vorbis-tools-1.0.0/ogg123/ogg123.c
@@ -108,6 +108,10 @@
     sig_request.last_ctrl_c = now;
     break;
 
+  case SIGTERM:
+    sig_request.exit = 1;
+    break;
+
   case SIGTSTP:
     sig_request.pause = 1;
     /* buffer_Pause (Options.outputOpts.buffer);
@@ -365,6 +369,7 @@
   signal (SIGINT, signal_handler);
   signal (SIGTSTP, signal_handler);
   signal (SIGCONT, signal_handler);
+  signal (SIGTERM, signal_handler);
 
 
   /* Play the files/streams */

<p><p>
-- 
Nate Straz                                              nstraz at sgi.com
sgi, inc                                           http://www.sgi.com/
Linux Test Project                                  http://ltp.sf.net/
--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis-dev mailing list