commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 02/03: grc: Move the XInitThreads to "As Ea


From: git
Subject: [Commit-gnuradio] [gnuradio] 02/03: grc: Move the XInitThreads to "As Early As Possible"
Date: Thu, 12 Feb 2015 22:25:36 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 40f5e6cdae82d279b95d7e02b8ef19d79dcd8163
Author: Sylvain Munaut <address@hidden>
Date:   Sun Jan 4 19:47:23 2015 +0100

    grc: Move the XInitThreads to "As Early As Possible"
    
    Seems some newer Qt do Xlib call right when doing the imports
    which then means that doing it in the main() is too late.
    
    Signed-off-by: Sylvain Munaut <address@hidden>
---
 grc/python/flow_graph.tmpl | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index 2a6ce72..859611e 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -30,19 +30,21 @@ $DIVIDER
 # Generated: $time.ctime()
 $DIVIDER
 
-# Call XInitThreads as the _very_ first thing.
-# After some Qt import, it's too late
+## Call XInitThreads as the _very_ first thing.
+## After some Qt import, it's too late
 #if $generate_options in ('wx_gui', 'qt_gui')
-import ctypes
-import sys
-if sys.platform.startswith('linux'):
-    try:
-        x11 = ctypes.cdll.LoadLibrary('libX11.so')
-        x11.XInitThreads()
-    except:
-        print "Warning: failed to XInitThreads()"
-#end if
+if __name__ == '__main__':
+    import ctypes
+    import sys
+    if sys.platform.startswith('linux'):
+        try:
+            x11 = ctypes.cdll.LoadLibrary('libX11.so')
+            x11.XInitThreads()
+        except:
+            print "Warning: failed to XInitThreads()"
 
+#end if
+#
 ########################################################
 ##Create Imports
 ########################################################
@@ -279,6 +281,7 @@ $param.get_make()#slurp
 $short_id#slurp
 #end def
 #if $generate_options != 'hb'
+
 if __name__ == '__main__':
     parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
     #set $params_eq_list = list()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]