Skip to main content

Questions tagged [qmutex]

The QMutex class, part of the Qt framework, provides access serialization between threads.

0 votes
1 answer
13 views

Non-symmetric mutex

I have an unknown number of processes that create independent data, and one function that modifies all existing data. I need to be able to prevent the modification of data when it is being created (or ...
Charles's user avatar
  • 1,163
-3 votes
1 answer
87 views

How to block a thread until a slot is received

I'm using Qt 6.6.1. I defined a class MyThread: class MyThread: public QThread As an inner class, I defined a class WakeUpEvent in the private section of the .h file: private: class WakeUpEvent : ...
Edward Cohen's user avatar
2 votes
1 answer
517 views

How to use QMutex correctly with QThread?

from PyQt5.QtCore import * from PyQt5.QtWidgets import * import time import sys import numpy as np class Mainthread(QThread): def __init__(self, parent): super().__init__(...
kerz's user avatar
  • 59
1 vote
1 answer
415 views

What is the difference between "thread and QThread" and "mutex and QMutex" in Python?

I'm doing research on multithreads in python. Can you explain the differences between "thread and QThread" and "mutex and QMutex"?
tirit's user avatar
  • 33
6 votes
2 answers
7k views

Multipass totally broken on MacOS & multipassd error logs

The com.canonical.multipassd service is constantly logging errors on my Mac and multipass won't work at all, even after reinstalling, rebooting, and updating my Mac. In an attempt to use my GPU in a ...
NJenkins's user avatar
  • 171
0 votes
5 answers
929 views

Do I need a QMutex for variable that is accessed by single statement?

In this document, a QMutex is used to protect "number" from being modified by multiple threads at same time. I have a code in which a thread is instructed to do different work according to a ...
William's user avatar
  • 943
2 votes
1 answer
229 views

And odd use of conditional variable with local mutex

Poring through legacy code of old and large project, I had found that there was used some odd method of creating thread-safe queue, something like this: template < typename _Msg> class WaitQue: ...
Swift - Friday Pie's user avatar
0 votes
0 answers
171 views

QThread, two QTimer's and QMutex deadlock

I have QObject with method, protected with QMutex. This method can be directly run from many threads. And I have another QObject living in other QThread with two QTimers. Timers have different ...
LunoXod-3's user avatar
0 votes
1 answer
780 views

QMutex::lock() taken by same QThread several times consecutively

I have a QThread spawned off from my main that is doing a synchronous read on a device. The read has a 1000ms timeout. The read is wrapped in a forever loop, and the read is protected with a QMutex. ...
Matt Brown's user avatar
0 votes
0 answers
192 views

QMutex locked by unknown thread

In the following code, I get an ASSERT in unlock (), because lockingThreads (a QList<QThread*>) does not contain the unlocking (current) thread. Examining lockingThreads, I find an "ntdll" ...
charlie's user avatar
  • 68
0 votes
1 answer
720 views

How to fix "In Qt two timer to one function, use qmutex will qeventloop for sleep"

I have some code use qtcpsocket to write and read, write-->sleep-->read; and ui had 2 and more timer to use this function; by i want i run synchronous;so i add mutex to lock it; by it deadlock; ...
danny's user avatar
  • 9
1 vote
2 answers
2k views

QMutex: destroying locked mutex

Given the following code: #include <chrono> #include <ctime> #include <functional> #include <iostream> #include <thread> #include <utility> #include <QFuture&...
canellas's user avatar
  • 687
2 votes
1 answer
3k views

Is threading.Lock() compatible with QThread() and is QMutex() compatible with python threads?

I'm using Python 3.7 (with PyQt5 for the GUI) on a Windows 10 computer. My application needs some multithreading. To do that, I use QThread(). I need to protect some code with a mutex. I figured I've ...
K.Mulier's user avatar
  • 8,769
1 vote
1 answer
733 views

"Attempting to reference a deleted function" after adding QMutex to class

I am building an application with Qt5. My program builds and runs fine, but there is a collision between two threads accessing a data structure. I have a QList of CanMessage objects, and I want to ...
Erik Johnson's user avatar
1 vote
1 answer
481 views

Crash creating QMutexLocker from child QThread

I have QMutex and QQueue as member in QThread based class. I'm locking QMutex (by QMutexLocker) in popEvent and pushEvent metods. When I lock it in push method called from main thread it works. When I ...
patrykbajos's user avatar

15 30 50 per page