Re: [AD] [UNIX] signals and threads

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On 2001-12-01, Eric Botcazou <ebotcazou@xxxxxxxxxx> wrote:
> > Please test and commit.
> 
> Commited.

The following patch (related to the previous ones in this thread) was
committed.  This solves a problem with programs under X with sound
hanging when three finger saluted.


Index: src/x/xkeybd.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/x/xkeybd.c,v
retrieving revision 1.8
diff -u -r1.8 xkeybd.c
--- src/x/xkeybd.c      2001/11/06 17:16:41     1.8
+++ src/x/xkeybd.c      2001/12/02 14:48:42
@@ -16,6 +16,10 @@
  */
 
 
+#include <signal.h>
+#include <unistd.h>
+#include <sys/types.h>
+
 #include "allegro.h"
 #include "allegro/internal/aintern.h"
 #include "allegro/platform/aintunix.h"
@@ -55,6 +59,11 @@
 
 
 
+/* the pid to kill when three finger saluting */
+static int main_pid;
+
+
+
 /* _xwin_keydrv_set_leds:
  *  Updates the LED state.
  */
@@ -114,7 +123,7 @@
          _sigalrm_request_abort();
       else
 #endif
-         exit(EXIT_SUCCESS);
+         kill(main_pid, SIGTERM);
    }
 }
 
@@ -157,6 +166,8 @@
    _xwin_keyboard_focused = _xwin_keydrv_focused;
 
    XUNLOCK();
+
+   main_pid = getpid();
 
    return 0;
 }
 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/