[Development] Qt 5 types under consideration for deprecation / removal in Qt 6

Allan Sandfeld Jensen kde at carewolf.com
Fri Aug 23 14:31:57 CEST 2019


On Friday, 23 August 2019 10:31:20 CEST Mutz, Marc via Development wrote:
> On 2019-05-29 12:53, Mutz, Marc via Development wrote:
> > === QWaitCondition -> std::condition_variable(_any) ===
> > 
> > Plumbing that std::condition_variable can do better.
> 
> So, I've looked at QWaitCondition because I had a need to call wait()
> with a QBasicMutex instead of a QMutex, and that doesn't exist, yet. I
> was surprised about what I saw, so I have to ask:
> 
> Do I understand it correctly that the implementation of QWaitCondition
> has _another_ mutex inside?! So, two mutexes? The one users pass in and
> then the one that QWaitCondition uses internally, because it's
> pthread_cond and that needs pthread_mutex?
> 
> If that's the case, shouldn't we run, not walk, to replace our internal
> uses with std::mutex + std::condition_variable to have only one mutex?
> 
https://code.woboq.org/gcc/libstdc++-v3/include/std/
condition_variable.html#std::_V2::condition_variable_any::_M_mutex

The std::conditional_variable has the same problem QWaitCondition has. No 
mutex is passed on construction or to the wake methods, so a second mutex is 
needed to protect waking/notifying. There is no other way with that API 
design.

'Allan





More information about the Development mailing list