Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-109364

Should we document that QWaitCondition never has spurious wakeups?

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.4.1
    • Core: Threads
    • None
    • 3730c55a8 (dev)

    Description

      "Normal" wait condition APIs (incl. std::condition_variable, std::condition_variable_any, pthreads, SleepConditionVariableCS, ...) suffer from spurious wakeups.

      QWaitCondition, in both its pthread and win32 implementations, does not suffer from it:

      • pthread code has an explicit wake counter
      • win32 code uses WaitForSingleEvent, which does not have spurious wakeups

      There's a lot of critical code in Qt (e.g. the QML scenegraph) that relies on QWaitCondition not to wake up spuriously.

      Also, this "feature" makes a QWaitCondition -> std::condition_variable upgrade not entirely straightforward.

      Should this behavior be actually documented?

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            thiago Thiago Macieira
            peppe Giuseppe D'Angelo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes