Oh well, thank you for the reply :) I am trying to do some networking stuff in the X Monad. Do you think there is some workaround such that I do the networking in an additional thread and then when it is done I fire some X11 event that XMonad can be programed to handle and then it can read the data recovered from the network and display it?

Thanks

On Sat, Nov 21, 2015 at 10:07 PM, Brandon Allbery <allbery.b@gmail.com> wrote:

On Sat, Nov 21, 2015 at 4:59 PM, Ernesto Rodriguez <neto@netowork.me> wrote:
When I attempt doing things like that, I usually get a deadlock. Is there any way to do this (I know, X is old :( but no harm in asking).

You can't, no, X11 is essentially incapable of it. (To the extent that gtk2/3 has hacks to forward stuff to the main thread.)
Individual threads can open their own connections, a trick you'll see in various contribs, but you can't share stuff between them; the best you could do is send clientMessages from one thread to the other.

(X11 has a call to "enable" multithreading. This wraps a Big Global Lock around all of X11. Even if you're using xcb, apparently, since if xcb could do it properly gtk wouldn't go to such lengths to avoid it.)

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net



--
Ernesto Rodriguez

Masters Student
Computer Science
Utrecht University

www.netowork.me
github.com/netogallo