Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!ncsuvx!gatech!bloom-beacon!EXPO.LCS.MIT.EDU!jim
From: jim@EXPO.LCS.MIT.EDU (Jim Fulton)
Newsgroups: comp.windows.x
Subject: re: Unix Signals and Xlib
Message-ID: <8809221417.AA01188@EXPO.LCS.MIT.EDU>
Date: 22 Sep 88 14:17:47 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Organization: X Consortium, MIT Laboratory for Computer Science
Lines: 18


If you are making calls to Xlib from inside a signal handler, you'll need to
make sure that you are interlocked with any other calls.  You could do this by
implementing the LockDisplay/UnlockDisplay (which are geared more towards
multiprocessor systems than what you are looking to do) calls in your Xlib, but
that would restrict you to using your own Xlib, reducing portability. 

Instead, if you can isolate all of your Xlib calls, you can stick a semaphore
around them that your signal handler can check to see whether or not it should
attempt any X stuff.  You still might run into problems if your machine can't
set the semaphore atomically (in which case you might want to block
interrupts).  If you are lucky, you might be able to structure things so that
the interrupt handler can simply put some sort of "job" onto a work queue that
will get processed as soon as whatever is doing the current Xlib calls
finishes. 

						Jim Fulton
						MIT X Consortium