Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!brutus.cs.uiuc.edu!apple!sun-barr!ames!uhccux!munnari.oz.au!bruce!goanna!dmh From: dmh@goanna.oz (Darren Hosking) Newsgroups: comp.windows.x Subject: SysV, signals and X Keywords: X, signals, SysV Message-ID: <2400@goanna.oz> Date: 20 Sep 89 07:10:20 GMT Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 34 Due to the nature of System V signal handling it is possible for system calls within an X library (specifically Xlib) to be interrupted, ie the system call that was interrupted will return an error (-1) and errno will be set to EINTR. This is not a problem in _XRead(), which does a read() from the socket to the server, as the interrupted system call error is explicitly checked for and the XIOErrorFunction is NOT called if the read() was interrupted. However, in _XSend, which does a write() to the socket connected to the server, the interrupted system call error is not checked for and therefore the XIOErrorFunction will be called if the write() is interrupted. How can you use signal() and your own signal handlers without the client generating an error message and exiting (because of the interrupted syscall)? For example, if you want to run an infinite loop of X calls (drawing rectangles or whatever) which is stopped by a SIGALRM and a signal handler, how can you guarantee that system calls within Xlib (or other X libraries) will not be interrupted and abort? One solution is to ignore the given signal each time you want to call an Xlib function and then reinstate it after the call, but the system call overhead could be substantial. Any ideas or solutions? Thanks in advance, dmh Darren Hosking ACSnet: dmh@goanna.oz Department Of Computer Science ARPA: dmh%goanna.oz.au@uunet.uu.net RMIT CSNET: dmh%goanna.oz.au@australia GPO Box 2476V UUCP: ...!uunet!goanna.oz.au!dmh Melbourne Vic., Australia 3001