Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!LARRY.MCRCIM.MCGILL.EDU!mouse From: mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) Newsgroups: comp.windows.x Subject: setitimer() and Xlib Message-ID: <9005090341.AA03843@Larry.McRCIM.McGill.EDU> Date: 9 May 90 03:41:38 GMT Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 33 [someone had trouble with xfig dying] > The version of xfig from the MIT distribution (1.4.3, I believe) used > setitimer() to blink the text cursor. That is an inherently unstable > method of doing anything in X that uses the X library, as the library > is not re-entrant. Lest anyone get confused by this statement... What this means is that you must not call Xlib routines from both the main level and the signal-handler level; it is not a general prohibition against using Xlib and setitimer() in the same program. Using setitimer() to arrange calls to a signal handler is perfectly safe (where as Xlib is concerned, at least) if the handler doesn't make any Xlib calls itself[%]. For example, int ticks; sigalrm_handler() { ticks ++; } should cause no trouble at all. [%] The handler must of course not do anything which is unsafe even from the main line, such as doing read()s and write()s on the X connection's file descriptor. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu