Re: threading problems...please help with workaround



Sven Neumann <sven gimp org> writes:

> Hi,
> 
> Ralph Walden <rwalden tripos com> writes:
> 
> > Any explanation as to WHY this works?
> > 
> > > > insert a call to gdk_flush() before gdk_threads_leave().
> 
> well, obviously X needs a kick in the ass here. gdk_flush() calls
> XSync() (that's all it does). The XSync function flushes the output 
> buffer and then waits until all requests have been received and 
> processed by the X server. I'm not really sure why this is necessary
> here. I tried this with GTK+ on DirectFB and the code Brad posted 
> did work perfectly without the call to gdk_flush().

Well, that's because DirectFB doesn't do anything interesting. :-)

X stores up requests in an internal buffer; this buffer is
flushed when:

 - A request requires a response from the X server  
 - It becomes too big
 - XPending() is called and there aren't any more events in the queue
 - SOmeone calls XFlush() or XSync() explicitely. 

Since the main loop isn't running, the third doesn't happen,
so you need to do the fourth.

Regards,
                                        Owen




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