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

QReadWriteLock::tryLockForRead() returns true although a writer is waiting

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.1.0
    • Fix Version/s: None
    • Component/s: Core: Threads
    • Labels:
      None

      Description

      QReadWriteLock::tryLockForRead() does not care about waiting writers. It returns true as long as no write lock is held.

      On the other hand QReadWriteLock::tryLockForRead(int timeout) works as expected. It returns false if a writer is waiting and the timer has expired.

      Possible solution:

      change line 207 of qreawritelock.cpp from
      if (d->accessCount < 0)
      to
      if ((d->accessCount < 0) || d->waitingWriters)

        Attachments

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

          Activity

            People

            Assignee:
            thiago Thiago Macieira
            Reporter:
            pille Peter Pille
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes