qreadwritelock.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/thread/qreadwritelock.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5namespace {-
6enum {-
7 StateMask = 0x3,-
8 StateLockedForRead = 0x1,-
9 StateLockedForWrite = 0x2,-
10};-
11const auto dummyLockedForRead = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(StateLockedForRead));-
12const auto dummyLockedForWrite = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(StateLockedForWrite));-
13inline bool isUncontendedLocked(const QReadWriteLockPrivate *d)-
14{ return
executed 317361 times by 523 tests: return quintptr(d) & StateMask;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusServiceWatcher
  • tst_QDBusThreading
  • tst_QDirIterator
  • tst_QFile
  • tst_QGlobalStatic
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_collections - unknown status
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • ...
quintptr(d) & StateMask;
executed 317361 times by 523 tests: return quintptr(d) & StateMask;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusServiceWatcher
  • tst_QDBusThreading
  • tst_QDirIterator
  • tst_QFile
  • tst_QGlobalStatic
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_collections - unknown status
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • ...
}
317361
15}-
16QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)-
17 : dd_ptr(recursionMode == Recursive ? new QReadWriteLockPrivate(recursionMode))true) : nullptr)-
18{-
19 ((!(!(quintptr(d_ptr.load()) & StateMask))) ? qt_assert_x("QReadWriteLock::QReadWriteLock", "bad d_ptr alignment",__FILE__,147) : qt_noop());-
20}
executed 42232 times by 296 tests: end of block
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • ...
42232
21-
22-
23-
24-
25-
26-
27-
28QReadWriteLock::~QReadWriteLock()-
29{-
30 auto d = d_ptr.load();-
31 if (isUncontendedLocked(d)
isUncontendedLocked(d)Description
TRUEnever evaluated
FALSEevaluated 43112 times by 519 tests
Evaluated by:
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusServiceWatcher
  • tst_QDBusThreading
  • tst_QGlobalStatic
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_collections - unknown status
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractfileengine - unknown status
  • tst_qabstractitemmodel - unknown status
  • ...
)
{
0-43112
32 QMessageLogger(__FILE__, 160, __PRETTY_FUNCTION__).warning("QReadWriteLock: destroying locked QReadWriteLock");-
33 return;
never executed: return;
0
34 }-
35 delete d;-
36}
executed 43112 times by 519 tests: end of block
Executed by:
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusServiceWatcher
  • tst_QDBusThreading
  • tst_QGlobalStatic
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_collections - unknown status
  • tst_compiler - unknown status
  • tst_gestures - unknown status
  • tst_lancelot - unknown status
  • tst_languagechange - unknown status
  • tst_largefile - unknown status
  • tst_modeltest - unknown status
  • tst_networkselftest - unknown status
  • tst_platformsocketengine - unknown status
  • tst_q_func_info - unknown status
  • tst_qabstractanimation - unknown status
  • tst_qabstractbutton - unknown status
  • tst_qabstractfileengine - unknown status
  • tst_qabstractitemmodel - unknown status
  • ...
43112
37void QReadWriteLock::lockForRead()-
38{-
39 QMutexLocker lockif (&d->mutexd_ptr.testAndSetAcquire(nullptr, dummyLockedForRead)
d_ptr.testAndS...LockedForRead)Description
TRUEevaluated 1557572 times by 355 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • ...
FALSEevaluated 143670 times by 10 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
)
143670-1557572
40 return;
executed 1557572 times by 355 tests: return;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • ...
1557572
41 tryLockForRead(-1);-
Qt}
executed 143670 times by 10 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
43bool QReadWriteLock::HANDLE self =tryLockForRead()-
44{-
45 return
executed 43 times by 2 tests: return tryLockForRead(0);
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
tryLockForRead(
executed 43 times by 2 tests: return tryLockForRead(0);
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 43 times by 2 tests: return tryLockForRead(0);
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
0);
executed 43 times by 2 tests: return tryLockForRead(0);
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
43
46}-
47bool QReadWriteLock::tryLockForRead(int timeout)-
48{-
49-
50 QReadWriteLockPrivate *d;-
51 if (d_ptr.testAndSetAcquire
d_ptr.testAndS...kedForRead, d)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 143712 times by 10 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
(nullptr, dummyLockedForRead, d->recursive)
d_ptr.testAndS...kedForRead, d)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 143712 times by 10 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
)
4-143712
52 return
executed 4 times by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
true;
executed 4 times by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
4
53-
54 while (true) {-
55 self = QThread::currentThreadId();0-143712
QHash<Qt::HANDLE, int>::iterator it =if (d ->currentReaders== 0
d == 0Description
TRUEnever evaluated
FALSEevaluated 143712 times by 10 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
) {
56 if (!d_ptr
!d_ptr.testAnd...kedForRead, d)Description
TRUEnever evaluated
FALSEnever evaluated
!d_ptr.testAnd...kedForRead, d)Description
TRUEnever evaluated
FALSEnever evaluated
.findtestAndSetAcquire(self);nullptr, dummyLockedForRead, d)
!d_ptr.testAnd...kedForRead, d)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
57 continue;
never executed: continue;
0
58 return
never executed: return true;
true;
never executed: return true;
0
59 }-
60-
61 if ((
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 132514 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 132514 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
quintptr(it !=d->currentReaders.end())) & StateMask) == StateLockedForRead
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 132514 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
{
11198-132514
62-
63 ++it.value();-
++const auto val = reinterpret_cast<QReadWriteLockPrivate *>(quintptr(d->accessCount;) + (1U<<4));
64 ((!(d->accessCountquintptr(val) > 0))(1U<<4))) ? qt_assert_x("QReadWriteLock::lockForReadtryLockForRead()", "Overflow in lock counter",-
65 __FILE__-
66 ,-
67 148240-
68 ) : qt_noop())-
69 ;-
return;
70 }0-11198
}
whileif (!d_ptr.testAndSetAcquire
!d_ptr.testAnd...ire(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
(d->accessCount < 0 ||d->waitingWriters) {
!d_ptr.testAnd...ire(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
++
!d_ptr.testAnd...ire(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
!d_ptr.testAnd...ire(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
, val, d->waitingReaders)
!d_ptr.testAnd...ire(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11198 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
)
71 continue
never executed: continue;
never executed: continue;
never executed: continue;
;
never executed: continue;
0
72 d->readerWait.wait(&d->mutex);11198
--d->waitingReadersreturn
executed 11198 times by 6 tests: return true;
Executed by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
executed 11198 times by 6 tests: return true;
Executed by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
true;
executed 11198 times by 6 tests: return true;
Executed by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
73 }-
74-
75 if (d ->recursive== dummyLockedForWrite
d == dummyLockedForWriteDescription
TRUEevaluated 42 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 132472 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) d{
42-132472
76 if (!timeout
!timeoutDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
2-40
77 return
executed 2 times by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
false;
executed 2 times by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
2
78-
79-
80 auto val = QReadWriteLockPrivate::allocate();-
81 val->currentReaderswriterCount = 1;-
82 if (!d_ptr
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
.inserttestAndSetOrdered(selfd, 1);
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
0-40
++
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
val, d)
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 40 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
83 val->accessCountwriterCount = 0;-
84 ((!(dval->accessCount > 0))release();-
85 continue;
never executed: continue;
0
86 }-
87 d = val;-
88 }
executed 40 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
40
89 ((!(!isUncontendedLocked(d))) ? qt_assert_xqt_assert("QReadWriteLock::lockForRead()", "Overflow in lock counter"!isUncontendedLocked(d)",__FILE__,162260) : qt_noop());-
90-
91-
92 }126-132386
bool QReadWriteLock::tryLockForRead()
{
QMutexLocker lock(&d->mutex);
Qt::HANDLE self = 0;if (d->recursive
d->recursiveDescription
TRUEevaluated 126 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 132386 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
93 {126
self = QThread::currentThreadId();
QHash<Qt::HANDLE, int>::iterator it =return
executed 126 times by 5 tests: return d->recursiveLockForRead(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 126 times by 5 tests: return d->recursiveLockForRead(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
d->currentReaders.findrecursiveLockForRead(selftimeout);
executed 126 times by 5 tests: return d->recursiveLockForRead(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
94-
95 QMutexLocker lock(&d->mutex);-
96 if (it !=d ->currentReaders!= d_ptr.endload()
d != d_ptr.load()Description
TRUEnever evaluated
FALSEevaluated 132386 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
0-132386
97-
98-
99-
100-
101-
102-
103 ++itd = d_ptr.valueloadAcquire();-
104 ++d->accessCountcontinue
never executed: continue;
;
never executed: continue;
0
105 ((!(}-
106 return
executed 132386 times by 3 tests: return d->lockForRead(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 132386 times by 3 tests: return d->lockForRead(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 132386 times by 3 tests: return d->lockForRead(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
d->accessCount > 0)) ? qt_assert_xlockForRead("QReadWriteLocktimeout);
executed 132386 times by 3 tests: return d->lockForRead(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
132386
107 }-
108}
never executed: end of block
0
109void QReadWriteLock::tryLockForReadlockForWrite()-
", "Overflow in lock counter"{
111 tryLockForWrite(-1);-
112}
executed 348346 times by 568 tests: end of block
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • ...
348346
113bool QReadWriteLock::tryLockForWrite()-
114{-
115 return
executed 62 times by 4 tests: return tryLockForWrite(0);
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
tryLockForWrite(0);
executed 62 times by 4 tests: return tryLockForWrite(0);
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
62
116}-
117bool QReadWriteLock::tryLockForWrite(int timeout)-
118{-
119-
120 QReadWriteLockPrivate *d;-
121 if (d_ptr.testAndSetAcquire(nullptr
d_ptr.testAndS...edForWrite, d)Description
TRUEevaluated 345353 times by 565 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
FALSEevaluated 3057 times by 11 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
d_ptr.testAndS...edForWrite, d)Description
TRUEevaluated 345353 times by 565 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
FALSEevaluated 3057 times by 11 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
, __FILE__dummyLockedForWrite, 194d)
d_ptr.testAndS...edForWrite, d)Description
TRUEevaluated 345353 times by 565 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
FALSEevaluated 3057 times by 11 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
3057-345353
122 return
executed 345353 times by 565 tests: return true;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
true;
executed 345353 times by 565 tests: return true;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
345353
123-
124 while (true) : qt_noop()){-
125 if (d == 0
d == 0Description
TRUEnever evaluated
FALSEevaluated 3057 times by 11 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
0-3057
126 if (!d_ptr.testAndSetAcquire(d, dummyLockedForWrite, d)
!d_ptr.testAnd...edForWrite, d)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
127 continue
never executed: continue;
never executed: continue;
never executed: continue;
;
never executed: continue;
0
128 return
never executed: return true;
true;
never executed: return true;
0
129 }}-
130-
131 if (isUncontendedLocked
isUncontendedLocked(d)Description
TRUEevaluated 88 times by 5 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
FALSEevaluated 2969 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
(d->accessCount < 0)
isUncontendedLocked(d)Description
TRUEevaluated 88 times by 5 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
FALSEevaluated 2969 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
88-2969
132 if (!timeout
!timeoutDescription
TRUEevaluated 10 times by 3 tests
Evaluated by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWriteLocker
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
10-78
133 return
executed 10 times by 3 tests: return false;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWriteLocker
false;
executed 10 times by 3 tests: return false;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWriteLocker
10
134-
135-
136 auto val = QReadWriteLockPrivate::allocate();-
137 if (d ->recursive== dummyLockedForWrite
d == dummyLockedForWriteDescription
TRUEevaluated 54 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
24-54
138 dval
executed 54 times by 3 tests: val->writerCount = 1;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
->currentReaderswriterCount = 1;
executed 54 times by 3 tests: val->writerCount = 1;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
54
139 else-
140 val->readerCount = (quintptr(d) >> 4) + 1;
executed 24 times by 3 tests: val->readerCount = (quintptr(d) >> 4) + 1;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
24
141 if (!d_ptr
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
.inserttestAndSetOrdered(selfd, 1);
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
0-78
++
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
val, d)
!d_ptr.testAnd...red(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 78 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
142 val->accessCount;-
((!(dwriterCount = val->accessCount >readerCount = 0));
143 val->release();-
144 continue;
never executed: continue;
0
145 }-
146 d = val;-
147 }
executed 78 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
78
148 ((!(!isUncontendedLocked(d))) ? qt_assert_xqt_assert("QReadWriteLock::tryLockForRead()", "Overflow in lock counter"!isUncontendedLocked(d)",__FILE__,205367) : qt_noop());-
149-
150-
151 if (d->recursive
d->recursiveDescription
TRUEevaluated 76 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
FALSEevaluated 2971 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
76-2971
152 return
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
true;
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
76
}
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
bool QReadWriteLock::tryLockForRead
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
d->recursiveLockForWrite(inttimeout)
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
{
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
);
executed 76 times by 8 tests: return d->recursiveLockForWrite(timeout);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
153-
154 QMutexLocker lock(&d->mutex);-
155 Qt::HANDLE self = 0;if (d ->recursive)!= d_ptr.load()
d != d_ptr.load()Description
TRUEnever evaluated
FALSEevaluated 2971 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
0-2971
156-
157-
158-
159 selfd = QThread::currentThreadIdd_ptr.loadAcquire();-
160 QHash<Qt::HANDLE, int>::iterator it =continue;
never executed: continue;
0
161 }-
162 return
executed 2971 times by 3 tests: return d->lockForWrite(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 2971 times by 3 tests: return d->lockForWrite(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 2971 times by 3 tests: return d->lockForWrite(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
d->currentReaders.findlockForWrite(selftimeout);
executed 2971 times by 3 tests: return d->lockForWrite(timeout);
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
2971
163 if (it != d->currentReaders.end())}-
164}
never executed: end of block
0
165void QReadWriteLock::unlock()-
166{-
167 ++itQReadWriteLockPrivate *d = d_ptr.valueload();-
168 ++d->accessCount;while (true) {-
169 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::tryLockForReadunlock()", "Overflow"Cannot inunlock lockan counter"unlocked lock",__FILE__,242397) : qt_noop())());-
170-
171-
172 if (quintptr(d) <= 2
quintptr(d) <= 2Description
TRUEevaluated 1902811 times by 572 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • ...
FALSEevaluated 146830 times by 13 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
146830-1902811
173 if (!d_ptr.testAndSetRelease(d, nullptr, d)
!d_ptr.testAnd...d, nullptr, d)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 1902810 times by 572 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • ...
)
1-1902810
174 continue
executed 1 time by 1 test: continue;
Executed by:
  • tst_QReadWriteLock
executed 1 time by 1 test: continue;
Executed by:
  • tst_QReadWriteLock
executed 1 time by 1 test: continue;
Executed by:
  • tst_QReadWriteLock
;
executed 1 time by 1 test: continue;
Executed by:
  • tst_QReadWriteLock
1
175 return
executed 1902810 times by 572 tests: return;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • ...
true;
executed 1902810 times by 572 tests: return;
Executed by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • ...
1902810
176 }}-
177-
178 whileif ((
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 135633 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
quintptr
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 135633 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
(d->accessCount < 0 ||d->waitingWriters) & StateMask) == StateLockedForRead
(quintptr(d) &...eLockedForReadDescription
TRUEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
FALSEevaluated 135633 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
11197-135633
179 ++((!(quintptr(d->waitingReaders;-
bool success =) > (1U<<4))) ? qt_assert("quintptr(d->readerWait.wait) > (&d->mutex1U<<4)",timeout__FILE__,407) : qt_noop());
180-
181 auto val = reinterpret_cast<0 ?QReadWriteLockPrivate *>(quintptr(9223372036854775807L * 2UL + 1ULd) : ulong- (timeout1U<<4));-
182 --d->waitingReaders;if (!success)
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
0-11197
return false;
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
}
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
if (d->recursive)
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
d->currentReaders
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
d_ptr.inserttestAndSetRelease(selfd, 1);
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
++
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
val, d->accessCount)
!d_ptr.testAnd...ase(d, val, d)Description
TRUEnever evaluated
FALSEevaluated 11197 times by 6 tests
Evaluated by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
)
183 continue
never executed: continue;
never executed: continue;
never executed: continue;
;
never executed: continue;
0
184 ((!(return;
executed 11197 times by 6 tests: return;
Executed by:
  • tst_QGuiEventLoop
  • tst_QHostInfo
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_Spdy
11197
185 }-
186-
187 ((!(!isUncontendedLocked(d->accessCount > 0))))) ? qt_assert_xqt_assert("QReadWriteLock::tryLockForRead()", "Overflow in lock counter"!isUncontendedLocked(d)",__FILE__,258415) : qt_noop());-
188-
189 if (d->recursive
d->recursiveDescription
TRUEevaluated 159 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
FALSEevaluated 135474 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
159-135474
190 d->recursiveUnlock();-
191 return
executed 159 times by 8 tests: return;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
true;
executed 159 times by 8 tests: return;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
159
192 }-
193-
194 void QReadWriteLock::lockForWrite()-
{QMutexLocker locklocker(&d->mutex);
195 Qt::HANDLE self = 0;if (d->recursivewriterCount
d->writerCountDescription
TRUEevaluated 3064 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 132410 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
3064-132410
196 self = QThread::currentThreadId();-
if (((!(d->currentWriterwriterCount == self) {
--d1)) ? qt_assert("d->accessCount;writerCount == 1",__FILE__,424) : qt_noop());
197 ((!(d->accessCount <readerCount == 0)) ? qt_assert_xqt_assert("QReadWriteLock::lockForWrite()", "Overflow in"d->readerCount lock== counter"0",__FILE__,285425) : qt_noop())-
;
return;
}
}
while (());
198 d->accessCount !=writerCount = 0);-
199 }
executed 3064 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
else
{
3064
200 ++((!(d->waitingWriters;readerCount > 0)) ? qt_assert("d->readerCount > 0",__FILE__,428) : qt_noop());-
201 d->writerWait.waitreaderCount--;-
202 if (&d->mutex);265-132145
--d->waitingWritersreaderCount > 0
d->readerCount > 0Description
TRUEevaluated 132145 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 265 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
203 return
executed 132145 times by 1 test: return;
Executed by:
  • tst_QReadWriteLock
executed 132145 times by 1 test: return;
Executed by:
  • tst_QReadWriteLock
executed 132145 times by 1 test: return;
Executed by:
  • tst_QReadWriteLock
;
executed 132145 times by 1 test: return;
Executed by:
  • tst_QReadWriteLock
132145
204 }
executed 265 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
265
205-
206 if (d->recursive)waitingReaders
d->waitingReadersDescription
TRUEevaluated 327 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 3002 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
|| d->currentWriter = self;
d->waitingWritersDescription
TRUEevaluated 2884 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
118-3002
--
d->waitingWritersDescription
TRUEevaluated 2884 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
d->waitingWritersDescription
TRUEevaluated 2884 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
waitingWriters
d->waitingWritersDescription
TRUEevaluated 2884 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 118 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
207 d->accessCount;unlock();-
208 }
executed 3211 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
else {
3211
209 ((!(d_ptr.load() == d->accessCount < 0)) ? qt_assert_xqt_assert("QReadWriteLock::lockForWrite"d_ptr.load()", "Overflow in lock== counter"d",__FILE__,299437) : qt_noop());-
210 d_ptr.storeRelease(nullptr);-
211 d->release();-
212 }
executed 118 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
118
213 boolreturn;
executed 3329 times by 3 tests: return;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
3329
214 }-
215}
never executed: end of block
0
216-
217-
218QReadWriteLock::tryLockForWriteStateForWaitCondition QReadWriteLock::stateForWaitCondition() const-
219{-
220 QMutexLocker lock(&d->mutex);-
Qt::HANDLE selfQReadWriteLockPrivate *d = 0d_ptr.load();
221 switch (quintptr(d) & StateMask) {-
222 case
executed 25 times by 1 test: case StateLockedForRead:
Executed by:
  • tst_QWaitCondition
StateLockedForRead:
executed 25 times by 1 test: case StateLockedForRead:
Executed by:
  • tst_QWaitCondition
return
executed 25 times by 1 test: return LockedForRead;
Executed by:
  • tst_QWaitCondition
LockedForRead;
executed 25 times by 1 test: return LockedForRead;
Executed by:
  • tst_QWaitCondition
25
223 case
executed 108 times by 1 test: case StateLockedForWrite:
Executed by:
  • tst_QWaitCondition
StateLockedForWrite:
executed 108 times by 1 test: case StateLockedForWrite:
Executed by:
  • tst_QWaitCondition
return
executed 108 times by 1 test: return LockedForWrite;
Executed by:
  • tst_QWaitCondition
LockedForWrite;
executed 108 times by 1 test: return LockedForWrite;
Executed by:
  • tst_QWaitCondition
108
224 }-
225-
226 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 141 times by 1 test
Evaluated by:
  • tst_QWaitCondition
)
0-141
227 return
never executed: return Unlocked;
Unlocked
never executed: return Unlocked;
never executed: return Unlocked;
;
never executed: return Unlocked;
0
228 if (d->recursivewriterCount > 1
d->writerCount > 1Description
TRUEnever evaluated
FALSEevaluated 141 times by 1 test
Evaluated by:
  • tst_QWaitCondition
)
0-141
229 {0
self = QThread::currentThreadId();return
never executed: return RecursivelyLocked;
never executed: return RecursivelyLocked;
RecursivelyLocked;
never executed: return RecursivelyLocked;
230 else if (d->currentWriterwriterCount == self1
d->writerCount == 1Description
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_QWaitCondition
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QWaitCondition
)
18-123
231 {123
--d->accessCountreturn
executed 123 times by 1 test: return LockedForWrite;
Executed by:
  • tst_QWaitCondition
executed 123 times by 1 test: return LockedForWrite;
Executed by:
  • tst_QWaitCondition
LockedForWrite;
executed 123 times by 1 test: return LockedForWrite;
Executed by:
  • tst_QWaitCondition
232 ((!(d->accessCount < 0))return
executed 18 times by 1 test: return LockedForRead;
Executed by:
  • tst_QWaitCondition
executed 18 times by 1 test: return LockedForRead;
Executed by:
  • tst_QWaitCondition
LockedForRead;
executed 18 times by 1 test: return LockedForRead;
Executed by:
  • tst_QWaitCondition
18
233-
234}-
235-
236bool QReadWriteLockPrivate::lockForRead(int timeout)-
237{-
238 ((!(!mutex.tryLock())) ? qt_assert_xqt_assert("QReadWriteLock::lockForWrite"!mutex.tryLock()", "Overflow in lock counter",__FILE__,328466) : qt_noop())-
;
return true());
239-
240 QElapsedTimer t;-
241 }1-132492
}if (d->accessCount !=timeout > 0
timeout > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 132492 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
242 t.start();
executed 1 time by 1 test: t.start();
Executed by:
  • tst_QReadWriteLock
1
243-
244 while (waitingWriters
waitingWritersDescription
TRUEevaluated 386 times by 2 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
FALSEevaluated 132543 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
|| writerCount
writerCountDescription
TRUEevaluated 72 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 132471 times by 6 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
72-132543
245 if (timeout ==
timeout == 0Description
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 437 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
timeout == 0Description
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 437 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
0
timeout == 0Description
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 437 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
21-437
246 return
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
false;
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
21
247 if (d->recursivetimeout > 0
timeout > 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 429 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) d->currentWriter{
8-429
248 auto elapsed = self;-
--d->accessCountt.elapsed();
249 if (elapsed > timeout
elapsed > timeoutDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
)
1-7
250 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
false
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
1
251 waitingReaders++;-
252 readerCond.wait(&mutex, timeout - elapsed);-
253 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QReadWriteLock
else {
7
254 waitingReaders++;-
255 readerCond.wait(&mutex);-
256 }
executed 429 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
429
257 waitingReaders--;-
258 }
executed 436 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
436
259 readerCount++;-
260 ((!(d->accessCount <writerCount == 0)) ? qt_assert_xqt_assert("QReadWriteLock::tryLockForWrite()", "Overflow in"writerCount lock== counter"0",__FILE__,340488) : qt_noop())-
;());
261 return
executed 132471 times by 6 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 132471 times by 6 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
132471
262}-
263-
264bool QReadWriteLockQReadWriteLockPrivate::tryLockForWritelockForWrite(int timeout)-
265{-
266 QMutexLocker lock((!(!mutex.tryLock())) ? qt_assert(&d->"!mutex);-
Qt::HANDLE self =.tryLock()",__FILE__,494) : qt_noop());
267-
268 QElapsedTimer t;-
269 if (timeout > 0
timeout > 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 3034 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
1-3034
270 t.start();
executed 1 time by 1 test: t.start();
Executed by:
  • tst_QReadWriteLock
1
271-
272 while (readerCount
readerCountDescription
TRUEevaluated 74 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 3276 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
|| writerCount
writerCountDescription
TRUEevaluated 264 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 3012 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
74-3276
273 if (timeout ==
timeout == 0Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 316 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
timeout == 0Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 316 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
0
timeout == 0Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 316 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
22-316
274 return
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
false
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
;
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
22
275 if (d->recursivetimeout > 0
timeout > 0Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 308 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
8-308
276 selfauto elapsed = QThread::currentThreadIdt.elapsed();-
277 if (d->currentWriter == selfelapsed > timeout
elapsed > timeoutDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
1-7
278 --d->accessCountif (waitingReaders
waitingReadersDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
&& !waitingWriters
!waitingWritersDescription
TRUEnever evaluated
FALSEnever evaluated
&& !writerCount
!writerCountDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0-1
279-
280-
281 readerCond.wakeAll();-
282 }
never executed: end of block
0
283 return
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
false
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QReadWriteLock
1
284 }-
285 waitingWriters++;-
286 writerCond.wait(&mutex, timeout - elapsed);-
287 }
executed 7 times by 1 test: end of block
Executed by:
  • tst_QReadWriteLock
else {
7
288 waitingWriters++;-
289 writerCond.wait(&mutex);-
290 }
executed 308 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
308
291 waitingWriters--;-
292 }
executed 315 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
315
293-
294 ((!(d->accessCount <writerCount == 0)) ? qt_assert_xqt_assert("QReadWriteLock::lockForWrite()","writerCount "Overflow== in0",__FILE__,522) : qt_noop());-
295 ((!(readerCount == 0)) ? qt_assert("readerCount lock== counter"0",__FILE__,375523) : qt_noop())());-
296 writerCount = 1;-
297 return
executed 3012 times by 9 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
true;
executed 3012 times by 9 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
3012
}}
299-
while (d->accessCount != 0)void QReadWriteLockPrivate::unlock()
301{-
302 ++d->waitingWriters;-
bool success = d->writerWait((!(!mutex.waittryLock())) ? qt_assert(&d->"!mutex.tryLock()",timeout < 0 ? (9223372036854775807L * 2UL + 1UL__FILE__,530) : ulongqt_noop());
303 if (timeout));417-2922
--d->waitingWriters;
waitingWritersDescription
TRUEevaluated 2922 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 417 times by 9 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
304 writerCond.wakeOne();
executed 2922 times by 3 tests: writerCond.wakeOne();
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
2922
305 else if (!success(waitingReaders
waitingReadersDescription
TRUEevaluated 290 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 127 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
127-290
306 return false;readerCond.wakeAll();
executed 290 times by 3 tests: readerCond.wakeAll();
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
290
307}
executed 3339 times by 9 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
3339
308-
ifbool QReadWriteLockPrivate::recursiveLockForRead(d->recursiveint timeout)
d->currentWriter = self;
--d->accessCount;{
311 ((!(d->accessCount < 0recursive)) ? qt_assert_xqt_assert("QReadWriteLock::tryLockForWrite()", "Overflow in lock counter""recursive",__FILE__,393539) : qt_noop());-
312 QMutexLocker lock(&mutex);-
313-
314 Qt::HANDLE self = QThread::currentThreadId();-
315-
316 auto it = currentReaders.find(self);-
317 if (it != currentReaders.end
it != currentReaders.end()Description
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 107 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
it != currentReaders.end()Description
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 107 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
()
it != currentReaders.end()Description
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 107 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
19-107
318 ++it.value();-
319 return
executed 19 times by 4 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 19 times by 4 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
19
320 }-
321-
322 if (!lockForRead(timeout)
!lockForRead(timeout)Description
TRUEevaluated 21 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 86 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
21-86
323 return
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
false
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
;
executed 21 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
21
324-
325 currentReaders.insert(self, 1);-
326 return
executed 86 times by 5 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 86 times by 5 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
86
327}-
328-
void QReadWriteLockbool QReadWriteLockPrivate::unlock()
{
QMutexLocker lockrecursiveLockForWrite(&d->mutex);int timeout)
330{-
331 ((!(d->accessCount != 0recursive)) ? qt_assert_xqt_assert("QReadWriteLock::unlock()", "Cannot unlock an unlocked lock""recursive",__FILE__,410559) : qt_noop());-
332 bool unlockedQMutexLocker lock(&mutex);-
333-
334 Qt::HANDLE self = false;QThread::currentThreadId();-
335 if (d->accessCount > 0currentWriter == self
currentWriter == selfDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 64 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
) {
12-64
336 writerCount++;-
337 return
executed 12 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 12 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
12
338 }-
339-
340 if (!lockForWrite
!lockForWrite(timeout)Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 42 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
(d->timeout)
!lockForWrite(timeout)Description
TRUEevaluated 22 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 42 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
22-42
341 return
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
false;
executed 22 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
22
342-
343 currentWriter = self;-
344 return
executed 42 times by 8 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
true;
executed 42 times by 8 tests: return true;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
42
345}-
346-
347void QReadWriteLockPrivate::recursiveUnlock()-
348{-
349 ((!(recursive)) ? qt_assert("recursive",__FILE__,577) {: qt_noop());-
350 QMutexLocker lock(&mutex);-
351-
352 Qt::HANDLE self = QThread::currentThreadId();-
353 QHash<Qt::HANDLE, int>::iteratorif (self == currentWriter
self == currentWriterDescription
TRUEevaluated 54 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
FALSEevaluated 105 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
54-105
354 if (--
--writerCount > 0Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 42 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
writerCount > 0
--writerCount > 0Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 42 times by 8 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
)
12-42
355 return;
executed 12 times by 2 tests: return;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
12
356 currentWriter = 0;-
357 }
executed 42 times by 8 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
else {
42
358 auto it = d->currentReaders.find(self);-
359 if (it != d->== currentReaders.end()
it == currentReaders.end()Description
TRUEnever evaluated
FALSEevaluated 105 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
0-105
360 QMessageLogger(__FILE__, 588, __PRETTY_FUNCTION__).warning("QReadWriteLock::unlock: unlocking from a thread that did not lock");-
361 return;
never executed: return;
0
362 } else {-
363 if (--
--it.value() <= 0Description
TRUEevaluated 86 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
it.value() <= 0
--it.value() <= 0Description
TRUEevaluated 86 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
) d->{
19-86
364 currentReaders.erase(it);-
365 readerCount--;-
366 }
executed 86 times by 5 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
86
367 if (readerCount
readerCountDescription
TRUEevaluated 19 times by 4 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 86 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
19-86
368 return;
executed 19 times by 4 tests: return;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
19
369 }
executed 86 times by 5 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
86
370 unlocked}-
371-
372 unlock();-
373}
executed 128 times by 8 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
128
374-
375-
376namespace {-
377struct FreeListConstants : QFreeListDefaultConstants {-
378 enum { BlockCount = --d->accessCount == 04, MaxIndex=0xffff };-
379 static const int Sizes[BlockCount];-
380};-
381const int FreeListConstants::Sizes[FreeListConstants::BlockCount] = {-
382 16,-
383 128,-
384 1024,-
385 FreeListConstants::MaxIndex - (16 + 128 + 1024)-
386};-
387-
388typedef QFreeList<QReadWriteLockPrivate, FreeListConstants> FreeList;-
} elsenamespace { namespace Q_QGS_freelist { typedef FreeList Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (d->accessCount < 0 && ++d->accessCountguard.load()
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qmetatype - unknown status
  • tst_qreadwritelock - unknown status
  • tst_qwaitcondition - unknown status
FALSEnever evaluated
== 0QtGlobalStatic::Initialized
guard.load() =...c::InitializedDescription
TRUEevaluated 3 times by 3 tests
Evaluated by:
  • tst_qmetatype - unknown status
  • tst_qreadwritelock - unknown status
  • tst_qwaitcondition - unknown status
FALSEnever evaluated
) guard.store(QtGlobalStatic::Destroyed);
executed 3 times by 3 tests: guard.store(QtGlobalStatic::Destroyed);
Executed by:
  • tst_qmetatype - unknown status
  • tst_qreadwritelock - unknown status
  • tst_qwaitcondition - unknown status
}
executed 3 times by 3 tests: end of block
Executed by:
  • tst_qmetatype - unknown status
  • tst_qreadwritelock - unknown status
  • tst_qwaitcondition - unknown status
}; static struct Holder : public HolderBase
{ unlocked = trueType value; Holder() noexcept(noexcept(Type ())) : value () { guard.store(QtGlobalStatic::Initialized); } } holder; return
executed 354 times by 3 tests: return &holder.value;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
&holder.value
executed 354 times by 3 tests: return &holder.value;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
;
executed 354 times by 3 tests: return &holder.value;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
} } } static QGlobalStatic<FreeList, Q_QGS_freelist::innerFunction, Q_QGS_freelist::guard> freelist;;
390}-
391-
392QReadWriteLockPrivate *QReadWriteLockPrivate::allocate()-
393{-
394 int i = freelist->next();-
395 QReadWriteLockPrivate *d = &(*freelist)[i];-
396 d->currentWriterid = 0i;-
397 }-
if (unlocked) {
if((!(!d->recursive)) ? qt_assert("!d->waitingWritersrecursive",__FILE__,625) {: qt_noop());
398 ((!(!d->writerWait.wakeOne();-
} else ifwaitingReaders && !d->waitingReaders && !d->readerCount && !d->writerCount)) ? qt_assert("!d->waitingReaders) { && !d->readerWait.wakeAll();
}waitingReaders && !d->readerCount && !d->writerCount",__FILE__,626) : qt_noop());
399 return
executed 118 times by 3 tests: return d;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
d;
executed 118 times by 3 tests: return d;
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
118
400}-
401-
402void QReadWriteLockPrivate::release()-
403{-
404 ((!(!recursive)) ? qt_assert("!recursive",__FILE__,632) : qt_noop());-
405 ((!(!waitingReaders && !waitingReaders && !readerCount && !writerCount)) ? qt_assert("!waitingReaders && !waitingReaders && !readerCount && !writerCount",__FILE__,633) : qt_noop());-
406 freelist->release(id);-
407}
executed 118 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
118
408-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9