dimanche 27 novembre 2022

Qt calling tryLock() multiple times on the same mutex from the same thread (5.13.2 ver.)

I have a question about the method bool QMutex::tryLock(int timeout). I notice that the description of this method in different (i.e. 5.15 and 6.4) versions are slightly different.

  • In  5.15 ver., the document says "Calling this function multiple times on the same mutex from the same thread is allowed if this mutex is a recursive mutex. If this mutex is a non-recursive mutex, this function will always return false when attempting to lock the mutex recursively."

  • In 6.4 ver., the document says "Calling this function multiple times on the same mutex from the same thread will cause a dead-lock."

I'm using Qt 5.13.2 version now. Is it alright to call tryLock multiple times on the same thread? Or the document of 5.15 ver. is incorrect. Thanks!

refs:

I sent a mail to the QT Team, but haven't receive the feedback yet.

Aucun commentaire:

Enregistrer un commentaire