Top Document: comp.windows.x.intrinsics Frequently Asked Questions (FAQ) Previous Document: 2. Related FAQ's Next Document: 4.! How do I use a different visual than the default? See reader questions & answers on this topic! - Help others by sharing your knowledge ---------------------------------------------------------------------- In brief, Xlib, Xt and most widget sets have no mutual exclusion for critical sections. Any interrupt handler is likely to leave one of the above libraries in an inconsistent state -- such as all the appropriate flags not yet set, dangling pointers, in the middle of a list traversal, etc. Note that the ANSI C standard points out that behavior of a signal handler is undefined if the signal handler calls any function other than signal() itself, so this is not a problem specific to Xlib and Xt; the POSIX specification mentions other functions which may be called safely but it may not be assumed that these functions are called by Xlib or Xt functions. The only safe way to deal with signals is to set a flag in the interrupt handler. This flag later needs to be checked either by a work procedure or a timeout callback. It is incorrect to add either of these in the interrupt handler. As another note, it is dangerous to add a work procedure that never finishes. This effectively preempts any work procedures previously added and so they will never be called. Another option is to open a pipe, tell the event loop about the read end using XtAppAddInput() and then the signal handler can write a byte to the write end of the pipe for each signal. However, this could deadlock your process if the pipe fills up. Why don't the Intrinsics deal with this problem? Primarily because it is supposed to be a portable layer to any hardware and operating system. Is that a good enough reason -- I don't think so. Note: the article in The X Journal 1:4 and the example in O'Reilly Volume 6 are in error. User Contributions:Top Document: comp.windows.x.intrinsics Frequently Asked Questions (FAQ) Previous Document: 2. Related FAQ's Next Document: 4.! How do I use a different visual than the default? Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: ware@cis.ohio-state.edu
Last Update March 27 2014 @ 02:11 PM
|
Comment about this article, ask questions, or add new information about this topic: