Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!dali.cs.montana.edu!milton!uw-beaver!ubc-cs!mprgate.mpr.ca!mprgate.mpr.ca!janzen From: janzen@mprgate.mpr.ca (Martin Janzen) Newsgroups: comp.windows.x Subject: Re: SIGIO/SIGALRM in conflict with XLib ? Message-ID: <1991May3.183814.26459@mprgate.mpr.ca> Date: 3 May 91 18:38:14 GMT References: <9105021507.AA18962@lightning.McRCIM.McGill.EDU> Sender: news@mprgate.mpr.ca Reply-To: janzen@mprgate.mpr.ca (Martin Janzen) Organization: MPR Teltech Ltd. Lines: 44 In article <9105021507.AA18962@lightning.McRCIM.McGill.EDU>, mouse@lightning.mcrcim.mcgill.EDU (der Mouse) replies to a question which has already expired from my system, so I don't know the author... >> = ??? > = der Mouse >> [...] >> The audio part is set up to receive SIGIO interrupts when it is time >> to read/write from/to the audio device. The program also receives >> SIGALRM interrupts that I use to display the peek level of the audio >> and to show record/play time. At each SIGALRM interrupt I send 1-2 >> draw requests to the X server. > >Danger, danger. > >> Both the imaging part and the audio part work if I run them one at a >> time. BUT it crash every time when I'm recording/playing and at the >> same time use the imaging part. > >Yup. > >["der Mouse" goes on to explain that Xlib won't work in signal handlers] My suggestion would be to replace the signals and signal handlers entirely if possible, by using the built-in XtAddInput and XtAddTimeOut functions. At the least, you should be able to use XtAddTimeOut to set a timer which calls a procedure to update the display at regular intervals. You can use any Xlib calls you want in this procedure, since there's no SIGALRM involved. Also, you could try using XtAddInput to add a procedure which is called when- ever reads or writes are possible on the audio device. (It eventually calls select(), including your file descriptors in the read- and write-masks.) If your SIGIO handler just does buffering and doesn't need to make Xlib calls, this probably isn't necessary. Also, the response time requirements of the audio device may force you to use an interrupt handler. But if you can move all the drawing code into the XtTimerCallbackProc, your SIGIO handler should work. -- Martin Janzen janzen@mprgate.mpr.ca (134.87.131.13) MPR Teltech Ltd. Phone: (604) 293-5309 8999 Nelson Way Fax: (604) 293-5787 Burnaby, BC, CANADA V5A 4B5