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

QThreadPool documentation is not clear is Properties are thread-safe as well

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.2.0
    • 4.7.4, 4.8.3
    • Core: QtConcurrent
    • None
    • 85b24bb2dea97c3a9b013bacd5a422b26fe5d14b

    Description

      Further to the bug summary.

      The src/corelib/concurrent/qthreadpool.cpp at QThreadPoolPrivate::acrtiveTghreadCount() it does not take a mutex to atomically read and perform arithmetic so a consistent return value is.

      The documentation should say the property is thread-safe (as in no harm will result from concurrent execution) but that he return value maybe inconsistent due to no internal locking.

      It is not clear (to me at least) if having a consistent view is useful anyway. i.e. so what if you get the correct value 100% of the time by the time you perform any action it could be out-of-date (certainly for the globalInstance() case).

      Attachments

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

        Activity

          People

            dfaure_kdab David Faure
            dlmiles Darryl L. Miles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes