threads gdk/Xlib



Hello all,

I am programming a testing app for a gtk widget that embeds Xine and I
am facing little problems with threads and XLib: the application crashes
all the time whith "Xlib: unexpected async reply"

It got fixed only when I called the following functions in the following
sequence:

XInitThreads ();
g_thread_init(NULL);    
gdk_threads_init();
gtk_init(&argc, &argv);

There is no need to put gtk_main() between gdk_threads_enter() and gdk_threads_leave().

To sum up: there are calls to Xlib from other threads, created by Xine. Gdk also calls Xlib but only from the
main thread (my app does not create any). Xine always calls XLockDisplay() before doing any of these calls.

Question then:

- Does Gdk call XLockdisplay() at all?
- Do you need to call XInitThreads() before gdk_threads_init() ? -> that's the way it seems to work for me.
- Why is this (ie the interaction between Xlib threads and Gdk threads) not documented anywhere?

Thanks for your help,

-- 
StÃphane Konstantaropoulos
- Research Student, Computer Science
-- University of York, http://www-users.cs.york.ac.uk/~stephane


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]