[xiph-commits] r14591 - trunk/rtrecord

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Sun Mar 16 01:37:17 PDT 2008


Author: xiphmont
Date: 2008-03-16 01:37:16 -0700 (Sun, 16 Mar 2008)
New Revision: 14591

Modified:
   trunk/rtrecord/main.c
Log:
Add proper signal handling to rtrecord so that the terminal is not always getting corrupted.



Modified: trunk/rtrecord/main.c
===================================================================
--- trunk/rtrecord/main.c	2008-03-16 05:08:10 UTC (rev 14590)
+++ trunk/rtrecord/main.c	2008-03-16 08:37:16 UTC (rev 14591)
@@ -97,6 +97,12 @@
 };
 channel_meta *pcm_data[2];
 
+void exit_handler(int sig){
+  signal(sig,SIG_IGN);
+  write(ttypipe[1],"q",1);
+  exiting = 1;  
+}
+
 /* used to redirect the real tty input into the pipe that ncurses
    thinks is the tty */
 void *tty_thread(void *dummy){
@@ -805,7 +811,9 @@
   pthread_create(&ui_thread_id,NULL,ui_thread,NULL);
   main_thread_id=pthread_self();
 
-  //signal(SIGINT,SIG_IGN);
+  signal(SIGINT,exit_handler);
+  signal(SIGSEGV,exit_handler);
+  signal(SIGPIPE,exit_handler);
 
 
   if(!quiet)



More information about the commits mailing list