Bug #596

Allow multithreaded GUI access on Linux

Added by Sylvain Munaut about 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:10/03/2013
Priority:NormalDue date:
Assignee:Johnathan Corgan% Done:


Target version:release-3.7.2


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.

0001-gr-wxgui-Make-call-to-XInitThreads-during-stdapp-ini.patch Magnifier (1.4 KB) Sylvain Munaut, 10/03/2013 04:06 pm

0002-grc-Make-call-to-XInitThreads-during-gui-flowgraph-i.patch Magnifier (1.14 KB) Sylvain Munaut, 10/03/2013 04:06 pm


#1 Updated by Johnathan Corgan about 2 years ago

  • Category set to gr-qtgui
  • Status changed from New to Assigned
  • Assignee set to Johnathan Corgan

#2 Updated by Sylvain Munaut almost 2 years ago

Several people tested the patch and didn't report any downsides, so it'd be nice to get this into mainline.

Without them fosphor pretty much just crash if any other UI element is used in the flowgraph ...

#3 Updated by Johnathan Corgan almost 2 years ago

  • Status changed from Assigned to Resolved
  • Target version set to release-3.7.2
  • Resolution set to fixed

Applied to maint and merged up.

#4 Updated by Johnathan Corgan almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF