problem with multithreaded application and Xlib

Francesco Abbate francesco.bbt at gmail.com
Thu Sep 30 08:44:23 PDT 2010


Hi all,

I don't really want to bother you guys, I know that you have all very
important developments ongoing. Actually I don't ask you to help me
about this particular problem that I've found with the snapshot
release of the Xserver/Xlib. What I would like to understand is if the
technique that I'm using with the two threads is actually correct or
not. Can I safely assume that my program does not works just because
of a bug in the snapshot release ? There is a more correct way to do
what I'm doing ?

I will be grateful if I could have at least some hints. Thank you very
much in advance.

My previous mail follow below.

Francesco

2010/9/28 Francesco Abbate <francesco.bbt at gmail.com>:
> Hi all,
>
> I've recently made the switch to the snapshot xorg server and the
> related X libraries and I've discovered that my application stopped to
> works correctly!
>
> Here the problem in short. I'm developing a multi-threaded application
> where the main thread run the X Window event loop. There is also a
> secondary thread that sometimes need to redraw the window or, more
> generally, perform operation on the X Display. In order to avoid
> problems I've arranged some locks so that the secondary thread perform
> its operations on the display only when the main thread is blocking in
> the XNextEvent operation. At this point is important to add that, yes,
> I'm using the XInitThread functions at the very beginning of the main
> loop.
>
> What happens is that the secondary thread blocks during the XSync
> operation until the main thread receive some events.
>
> I'm wondering if the assumption that I'm doing in my code is wrong or
> if it is a bug of the X server or may be the X library. It seems to me
> that it is like if Xlib does not honor the XInitThreads call because
> it does not allow an ordinary XSync to terminate if there is a pending
> XNextEevent call at the same time (by another thread).
>
> I hope someone can help me to clarify the problem.
>
> Best regards,
> Francesco
>



-- 
Francesco


More information about the xorg-devel mailing list