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

QThread::sleep taking time in seconds may be unexpected

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 5.6.3, 5.9.4, 5.10.1
    • Core: Threads
    • None

    Description

      Posix sleep takes seconds, but Windows sleep takes milliseconds.

      Compare to solution used by std::this_thread::sleep_for, which uses explicit typing to ensure the caller knows what's what.

      Example of possible better interface:

      QThread::sleep(qSeconds(1));
      

      ...where qSeconds returns a typed object. Alternatively also providing qMiliseconds and qNanoseconds would make the interface of QThread cleaner IMO.

      I understand that this would probably be something for Qt 6, and there should still be a compatibility flag that allows existing implementations to remain compatible.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            asperamanca Robert Schimkowitsch
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes