[education/rkward] rkward/rbackend/rkwarddevice: Better thread synchronization
Thomas Friedrichsmeier
null at kde.org
Mon Sep 15 12:58:05 BST 2025
Git commit 032ba31395d2b7c006afcfb60ff51f0d8997ed00 by Thomas Friedrichsmeier.
Committed on 15/09/2025 at 11:57.
Pushed by tfry into branch 'master'.
Better thread synchronization
M +9 -7 rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
https://invent.kde.org/education/rkward/-/commit/032ba31395d2b7c006afcfb60ff51f0d8997ed00
diff --git a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
index 3886334a4..1eb5a3057 100644
--- a/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
+++ b/rkward/rbackend/rkwarddevice/rkgraphicsdevice_backendtransmitter.cpp
@@ -100,20 +100,22 @@ void RKGraphicsDeviceBackendTransmitter::run() {
while (alive) {
doWrite();
if (connection->bytesToWrite()) continue;
- if (expecting_reply) {
- {
- QMutexLocker lock(&mutex);
+ {
+ QMutexLocker lock(&mutex);
+ if (commit_pending) continue;
+ if (expecting_reply) {
if (!streamer.instream.atEnd() || streamer.readInBuffer()) {
have_reply = true;
expecting_reply = false;
read_available.wakeAll();
continue;
}
+ lock.unlock();
+ connection->waitForReadyRead(100); // don't wait too long: An RKDCancel may have been committed, meanwhile!
+ lock.relock();
+ } else {
+ write_available.wait(&mutex);
}
- connection->waitForReadyRead(100); // don't wait too long: An RKDCancel may have been committed, meanwhile!
- } else {
- QMutexLocker lock(&mutex);
- write_available.wait(&mutex);
}
}
More information about the rkward-tracker
mailing list