[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page

Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 193) How do I render rotated text?
Next Document: 195) How can I ensure that only one instance of my application is running?


194) Why doesn't my multi-threaded X program work (sic) ?



Support in Xlib and Xt for multi-threaded X programs is included in X11R6.
See the documentation for XInitThreads, XtToolkitThreadInitialize, section
2.7 of the Xlib specification, section 7.12 of the Xt specification, and the
article "Multi-Threaded Xlib," The X Resource, Issue 5, by Stephen Gildea.
The following discussion applies only to pre-R6 libraries:

You cannot use non-thread aware, non-reentrant libraries with threads.

If you must do this, you have only one choice: call the functions from the
initial thread only.

Why opening windows from other threads causes protocol errors can be
explained easily: you are accessing shared resources (the display
structure, the connection to the display, static data in the Xlib) from
a number of threads at the same time, without using any form of
exclusive access control.

[Thanks to casper@fwi.uva.nl (Casper H.S. Dik)]



Top Document: comp.windows.x Frequently Asked Questions (FAQ) 7/7
Previous Document: 193) How do I render rotated text?
Next Document: 195) How can I ensure that only one instance of my application is running?

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
faq%craft@uunet.uu.net (X FAQ maintenance address)

Last Update December 01 2008 @ 00:13 AM

© 2008 FAQS.ORG. All rights reserved.