diff options
author | Sylvain Munaut <246tnt@gmail.com> | 2013-10-13 17:19:37 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2013-10-13 17:20:19 -0700 |
commit | d5f0cec440ef2848992ce0ae34bfe73bb0c9772a (patch) | |
tree | b5e806e3095e664aa8520f30d398179e1aae0c96 /gr-wxgui/python/wxgui/stdgui2.py | |
parent | fb9ad6e707e09c3761762aad2a6673ac5b6c7e2e (diff) |
wxgui: Allow Linux/X11 apps to be thread-safe
Call XInitThreads as first Xlib call
Diffstat (limited to 'gr-wxgui/python/wxgui/stdgui2.py')
-rw-r--r-- | gr-wxgui/python/wxgui/stdgui2.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gr-wxgui/python/wxgui/stdgui2.py b/gr-wxgui/python/wxgui/stdgui2.py index 71436d72c4..b38589988e 100644 --- a/gr-wxgui/python/wxgui/stdgui2.py +++ b/gr-wxgui/python/wxgui/stdgui2.py @@ -21,6 +21,8 @@ '''A simple wx gui for GNU Radio applications''' +import ctypes +import os import wx import sys from gnuradio import gr @@ -33,6 +35,13 @@ class stdapp (wx.App): self.title = title self._nstatus = nstatus self._max_noutput_items = max_noutput_items + # If we're on Linux, also enable multi-threading Xlib access + if os.name == 'posix': + try: + x11 = ctypes.cdll.LoadLibrary('libX11.so') + x11.XInitThreads() + except: + print "Warning: failed to XInitThreads()" # All our initialization must come before calling wx.App.__init__. # OnInit is called from somewhere in the guts of __init__. wx.App.__init__ (self, redirect=False) |