Allow multithreaded GUI access on Linux
|Assignee:||Johnathan Corgan||% Done:|
To allow the Xlib to be thread safe, a call to XInitThread must be made very early (i.e. first Xlib call) during the application startup.
This mean that if a block needs that capability, it can't implement it itself, GR must take care of this. I couldn't find any down side to making this call all the time. There is a small overhead but it shouldn't matter in this instance. There used to be some issues with some toolkits but those are all pretty old and nowadays everything should run fine.
I've attached two patches that do that for :
- GRC generated applications
- WX GUI application using the stdapp top-block
I've tested those successfully on my laptop and they should have no impact on Win32 and OSX and shouldn't have any negative impact for people running Linux but of course it'd be nice if someone could actually test them.
There is still QT python app, for which I'm still thinking a
For purely C++ app or more custom stuff, there isn't much we can do. The author will just have to be aware that if they instanciate blocks that require this capability, they'll have to take care of initializing X properly themselves.