aboutsummaryrefslogtreecommitdiffstats
path: root/examples/network/blockingfortuneclient/blockingfortuneclient.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/blockingfortuneclient/blockingfortuneclient.py')
-rw-r--r--examples/network/blockingfortuneclient/blockingfortuneclient.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.py b/examples/network/blockingfortuneclient/blockingfortuneclient.py
index 50f4c1662..b997a8f7d 100644
--- a/examples/network/blockingfortuneclient/blockingfortuneclient.py
+++ b/examples/network/blockingfortuneclient/blockingfortuneclient.py
@@ -73,13 +73,13 @@ class FortuneThread(QThread):
self.wait()
def request_new_fortune(self, hostname, port):
- locker = QMutexLocker(self.mutex)
- self._host_name = hostname
- self.port = port
- if not self.isRunning():
- self.start()
- else:
- self.cond.wakeOne()
+ with QMutexLocker(self.mutex):
+ self._host_name = hostname
+ self.port = port
+ if not self.isRunning():
+ self.start()
+ else:
+ self.cond.wakeOne()
def run(self):
self.mutex.lock()