Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!pacbell.com!ames!haven!decuac!shlump.nac.dec.com!pa.dec.com!wsl.dec.com!klee From: klee@wsl.dec.com (Ken Lee) Newsgroups: comp.windows.x Subject: Re: signals using XLib Message-ID: <1990Dec18.112056@wsl.dec.com> Date: 18 Dec 90 19:20:56 GMT References: <1990Dec17.134238.26720@nas.nasa.gov> Sender: news@pa.dec.com (News) Reply-To: klee@wsl.dec.com Organization: DEC Western Software Laboratory Lines: 23 In article <1990Dec17.134238.26720@nas.nasa.gov>, parlette@nas.nasa.gov (Edward B. Parlette) writes: |> |> I am writing a program using straight XLib and need to be able |> to break out of the Event loop if I haven't received a keypress |> event within a certain amount of time. I have used alarm calls |> in the past for this and am wondering if this will cause a problem |> with XLib calls ?? I thought I saw a message on the new that claimed |> using signals with X was a bad idea but I have forgotten why. |> Can someone refresh my memory ?? Thanks. You can use signals with Xlib as long as you do not call any Xlib functions from your signal handler. If the signal interrupted a write to the server connection and then you send new requests in the signal handler, the server will get very confused. If you're just interested in timers, try a select() on the ConnectionNumber() and setting a timeout in the select(). Alternatively, you can use the timer facility in the X Toolkit. -- Ken Lee DEC Western Software Laboratory, Palo Alto, Calif. Internet: klee@wsl.dec.com uucp: uunet!decwrl!klee