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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.1.0
    • Core: Threads
    • 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

            thiago Thiago Macieira
            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