Is it possible to mix a c++11 mutex with a Qthread?
For example if you have a Dll that you want to use with a qt gui that will load a function from your Dll and also a function to update the gui on separate threads. The Dll function contains a large loop and a C++11 mutex is placed so that only one thread can read or write from the variables being used in the Dll function. Is it possible or feasible to use QThreads or must QThreads be used with QMutexs and likewise for C++11 thread operations?
I can't think of a reason why you couldn't use c++11 mutexes with QThread. Locking a QMutex or C++11 mutex will have the same effect: you can't relock it unless it has been unlocked (or configured for recursive lock, if available). I don't think that the QMutex implementation is tightly coupled with QThread.
I suppose both C++11 mutexes and QMutex rely on pthread when implemented in Linux. They probably both rely on the Windows API when implemented on Windows.
Of course, feel free to correct me if I'm wrong.
Btw, did you run any test usign C++11 mutex with QThread?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With