summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-07-15 16:24:49 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-07-15 16:57:57 -0300
commit986ff80c16efea0e32ff78012b2fd3c95b83e179 (patch)
tree8cae89f5ad66b12b1b6163a13e15eaa546838f3f
parent7c7c2d49b172d08e106e297101142747eaf78944 (diff)
Replace QThread with threading.Thread.
-rw-r--r--src/leap/bitmask/backend/signaler_qt.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/leap/bitmask/backend/signaler_qt.py b/src/leap/bitmask/backend/signaler_qt.py
index 4ec27a1e..433f18ed 100644
--- a/src/leap/bitmask/backend/signaler_qt.py
+++ b/src/leap/bitmask/backend/signaler_qt.py
@@ -33,7 +33,7 @@ import logging
logger = logging.getLogger(__name__)
-class SignalerQt(QtCore.QThread):
+class SignalerQt(QtCore.QObject):
"""
Signaling server.
Receives signals from the signaling client and emit Qt signals for the GUI.
@@ -42,11 +42,24 @@ class SignalerQt(QtCore.QThread):
BIND_ADDR = "tcp://127.0.0.1:%s" % PORT
def __init__(self):
- QtCore.QThread.__init__(self)
+ QtCore.QObject.__init__(self)
+
+ # Note: we use a plain thread instead of a QThread since works better.
+ # The signaler was not responding on OSX if the worker loop was run in
+ # a QThread.
+ # Possibly, ZMQ was not getting cycles to do work because Qt not
+ # receiving focus or something.
+ self._worker_thread = threading.Thread(target=self._run)
self._do_work = threading.Event()
+
+ def start(self):
+ """
+ Start the worker thread for the signaler server.
+ """
self._do_work.set()
+ self._worker_thread.start()
- def run(self):
+ def _run(self):
"""
Start a loop to process the ZMQ requests from the signaler client.
"""