home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / 21414 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.7 KB  |  44 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!ufo!swat!kaleb
  3. From: kaleb@swat (Kaleb Keithley)
  4. Subject: Re: Why X libraries are not reentrant?
  5. Message-ID: <1993Jan21.171844.23941@jpl-devvax.jpl.nasa.gov>
  6. Sender: usenet@jpl-devvax.jpl.nasa.gov (For NNTP so rrn will be able to post)
  7. Nntp-Posting-Host: swat
  8. Organization: Jet Propulsion Laboratory (NASA)
  9. References: <1993Jan14.232031.9316@selway.umt.edu> <1993Jan19.025831.19583@thunder.mcrcim.mcgill.edu> <1993Jan20.090241.1810@cenatls.cena.dgac.fr>
  10. Date: Thu, 21 Jan 1993 17:18:44 GMT
  11. Lines: 31
  12.  
  13. In article bruniau@cenatls.cena.dgac.fr (Christophe Bruniau) writes:
  14. >|> 
  15. >|> > and Why X libraries are not reentrant?,
  16. >|> 
  17. >|> Because it's a lot of work and nobody's been willing to do it.
  18. >|> 
  19. >
  20. >At this point, there is an interesting question:
  21. > How does one address the problem of handling interrupts (for instance Unix
  22. > Signals) involving X Window actions in a sequential language like C ?
  23.  
  24. Isn't this in the FAQ yet?
  25.  
  26. One (perhaps inelegant) solution involves opening a pipe and write() to
  27. the pipe in the signal handler.  Write is re-entrant.
  28.  
  29. You can then select() for read on both the pipe and your Display connection 
  30. and safely perform your "signal triggered" routine upon receipt of data on 
  31. the pipe.
  32.  
  33. >An example of such a problem is when one wants to process data from a network
  34. > while computing the MainLoop. Is the interleaving of busy waiting of Network
  35. > data and X events the only solution ?
  36.  
  37. Network data?  In Xlib, select() on both the Display connection and the 
  38. network data connection.  In Xt, use XtAppAddInput().
  39.  
  40. -- 
  41.  
  42. Kaleb Keithley                               kaleb@jpl-devvax.jpl.nasa.gov
  43.  
  44.