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-
5-
6QReadWriteLock::QReadWriteLock(RecursionMode recursionMode)-
7 : d(new QReadWriteLockPrivate(recursionMode))-
8{ }
executed 39003 times by 297 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
  • ...
39003
9-
10-
11-
12-
13-
14-
15-
16QReadWriteLock::~QReadWriteLock()-
17{-
18 delete d;-
19}
executed 39976 times by 552 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
  • ...
39976
20void QReadWriteLock::lockForRead()-
21{-
22 QMutexLocker lock(&d->mutex);-
23-
24 Qt::HANDLE self = 0;-
25 if (d->recursive
d->recursiveDescription
TRUEevaluated 90 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1685730 times by 357 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
  • ...
) {
90-1685730
26 self = QThread::currentThreadId();-
27-
28 QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);-
29 if (it != d->currentReaders.end()
it != d->currentReaders.end()Description
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QFile
FALSEevaluated 82 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
8-82
30 ++it.value();-
31 ++d->accessCount;-
32 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::lockForRead()", "Overflow in lock counter",-
33 __FILE__-
34 ,-
35 148-
36 ) : qt_noop())-
37 ;-
38 return;
executed 8 times by 2 tests: return;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QFile
8
39 }-
40 }
executed 82 times by 5 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
82
41-
42 while (d->accessCount < 0
d->accessCount < 0Description
TRUEevaluated 61 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1686319 times by 357 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
  • ...
|| d->waitingWriters
d->waitingWritersDescription
TRUEevaluated 507 times by 2 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
FALSEevaluated 1685812 times by 357 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
  • ...
) {
61-1686319
43 ++d->waitingReaders;-
44 d->readerWait.wait(&d->mutex);-
45 --d->waitingReaders;-
46 }
executed 568 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
568
47 if (d->recursive
d->recursiveDescription
TRUEevaluated 82 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1685730 times by 357 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
  • ...
)
82-1685730
48 d->currentReaders.insert(self, 1);
executed 82 times by 5 tests: d->currentReaders.insert(self, 1);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
82
49-
50 ++d->accessCount;-
51 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::lockForRead()", "Overflow in lock counter",__FILE__,162) : qt_noop());-
52}
executed 1685812 times by 357 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_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
  • ...
1685812
53bool QReadWriteLock::tryLockForRead()-
54{-
55 QMutexLocker lock(&d->mutex);-
56-
57 Qt::HANDLE self = 0;-
58 if (d->recursive
d->recursiveDescription
TRUEevaluated 36 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 7 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
7-36
59 self = QThread::currentThreadId();-
60-
61 QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);-
62 if (it != d->currentReaders.end()
it != d->currentReaders.end()Description
TRUEevaluated 11 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
11-25
63 ++it.value();-
64 ++d->accessCount;-
65 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::tryLockForRead()", "Overflow in lock counter",-
66 __FILE__-
67 ,-
68 194-
69 ) : qt_noop())-
70 ;-
71 return
executed 11 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 11 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
11
72 }-
73 }
executed 25 times by 2 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
25
74-
75 if (d->accessCount < 0
d->accessCount < 0Description
TRUEevaluated 23 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 9 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
)
9-23
76 return
executed 23 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
false;
executed 23 times by 2 tests: return false;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
23
77 if (d->recursive
d->recursiveDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
)
4-5
78 d->currentReaders.insert(self, 1);
executed 4 times by 2 tests: d->currentReaders.insert(self, 1);
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
4
79-
80 ++d->accessCount;-
81 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::tryLockForRead()", "Overflow in lock counter",__FILE__,205) : qt_noop());-
82-
83 return
executed 9 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
true;
executed 9 times by 2 tests: return true;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
9
84}-
85bool QReadWriteLock::tryLockForRead(int timeout)-
86{-
87 QMutexLocker lock(&d->mutex);-
88-
89 Qt::HANDLE self = 0;-
90 if (d->recursive
d->recursiveDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
0-3
91 self = QThread::currentThreadId();-
92-
93 QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);-
94 if (it != d->currentReaders.end()
it != d->currentReaders.end()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
95 ++it.value();-
96 ++d->accessCount;-
97 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::tryLockForRead()", "Overflow in lock counter",-
98 __FILE__-
99 ,-
100 242-
101 ) : qt_noop())-
102 ;-
103 return
never executed: return true;
true;
never executed: return true;
0
104 }-
105 }
never executed: end of block
0
106-
107 while (d->accessCount < 0
d->accessCount < 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
|| d->waitingWriters
d->waitingWritersDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
0-2
108 ++d->waitingReaders;-
109 bool success = d->readerWait.wait(&d->mutex, timeout < 0 ? (9223372036854775807L * 2UL + 1UL) : ulong(timeout));-
110 --d->waitingReaders;-
111 if (!success
!successDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEnever evaluated
)
0-1
112 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
1
113 }
never executed: end of block
0
114 if (d->recursive
d->recursiveDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
)
0-2
115 d->currentReaders.insert(self, 1);
never executed: d->currentReaders.insert(self, 1);
0
116-
117 ++d->accessCount;-
118 ((!(d->accessCount > 0)) ? qt_assert_x("QReadWriteLock::tryLockForRead()", "Overflow in lock counter",__FILE__,258) : qt_noop());-
119-
120 return
executed 2 times by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
true;
executed 2 times by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
2
121}-
122void QReadWriteLock::lockForWrite()-
123{-
124 QMutexLocker lock(&d->mutex);-
125-
126 Qt::HANDLE self = 0;-
127 if (d->recursive
d->recursiveDescription
TRUEevaluated 37 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 330454 times by 559 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • 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
  • tst_QButtonGroup
  • ...
) {
37-330454
128 self = QThread::currentThreadId();-
129-
130 if (d->currentWriter == self
d->currentWriter == selfDescription
TRUEnever evaluated
FALSEevaluated 37 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
) {
0-37
131 --d->accessCount;-
132 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::lockForWrite()", "Overflow in lock counter",-
133 __FILE__-
134 ,-
135 285-
136 ) : qt_noop())-
137 ;-
138 return;
never executed: return;
0
139 }-
140 }
executed 37 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
37
141-
142 while (d->accessCount != 0
d->accessCount != 0Description
TRUEevaluated 261 times by 5 tests
Evaluated by:
  • tst_QDBusConnection
  • tst_QDBusThreading
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 330491 times by 563 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_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
) {
261-330491
143 ++d->waitingWriters;-
144 d->writerWait.wait(&d->mutex);-
145 --d->waitingWriters;-
146 }
executed 261 times by 5 tests: end of block
Executed by:
  • tst_QDBusConnection
  • tst_QDBusThreading
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
261
147 if (d->recursive
d->recursiveDescription
TRUEevaluated 37 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 330454 times by 559 tests
Evaluated by:
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • 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
  • tst_QButtonGroup
  • ...
)
37-330454
148 d->currentWriter = self;
executed 37 times by 8 tests: d->currentWriter = self;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_qabstractfileengine - unknown status
  • tst_qdiriterator - unknown status
  • tst_qfile - unknown status
37
149-
150 --d->accessCount;-
151 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::lockForWrite()", "Overflow in lock counter",__FILE__,299) : qt_noop());-
152}
executed 330491 times by 563 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_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
  • ...
330491
153bool QReadWriteLock::tryLockForWrite()-
154{-
155 QMutexLocker lock(&d->mutex);-
156-
157 Qt::HANDLE self = 0;-
158 if (d->recursive
d->recursiveDescription
TRUEevaluated 39 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 23 times by 3 tests
Evaluated by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWriteLocker
) {
23-39
159 self = QThread::currentThreadId();-
160-
161 if (d->currentWriter == self
d->currentWriter == selfDescription
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 27 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
12-27
162 --d->accessCount;-
163 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::lockForWrite()", "Overflow in lock counter",-
164 __FILE__-
165 ,-
166 328-
167 ) : qt_noop())-
168 ;-
169 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
170 }-
171 }
executed 27 times by 2 tests: end of block
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
27
172-
173 if (d->accessCount != 0
d->accessCount != 0Description
TRUEevaluated 32 times by 4 tests
Evaluated by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
FALSEevaluated 18 times by 4 tests
Evaluated by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
)
18-32
174 return
executed 32 times by 4 tests: return false;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
false;
executed 32 times by 4 tests: return false;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
32
175 if (d->recursive
d->recursiveDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 13 times by 3 tests
Evaluated by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWriteLocker
)
5-13
176 d->currentWriter = self;
executed 5 times by 2 tests: d->currentWriter = self;
Executed by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
5
177-
178 --d->accessCount;-
179 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::tryLockForWrite()", "Overflow in lock counter",-
180 __FILE__-
181 ,-
182 340-
183 ) : qt_noop())-
184 ;-
185-
186 return
executed 18 times by 4 tests: return true;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
true;
executed 18 times by 4 tests: return true;
Executed by:
  • tst_QReadLocker
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_QWriteLocker
18
187}-
188bool QReadWriteLock::tryLockForWrite(int timeout)-
189{-
190 QMutexLocker lock(&d->mutex);-
191-
192 Qt::HANDLE self = 0;-
193 if (d->recursive
d->recursiveDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
0-2
194 self = QThread::currentThreadId();-
195-
196 if (d->currentWriter == self
d->currentWriter == selfDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
197 --d->accessCount;-
198 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::lockForWrite()", "Overflow in lock counter",-
199 __FILE__-
200 ,-
201 375-
202 ) : qt_noop())-
203 ;-
204 return
never executed: return true;
true;
never executed: return true;
0
205 }-
206 }
never executed: end of block
0
207-
208 while (d->accessCount != 0
d->accessCount != 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
) {
1
209 ++d->waitingWriters;-
210 bool success = d->writerWait.wait(&d->mutex, timeout < 0 ? (9223372036854775807L * 2UL + 1UL) : ulong(timeout));-
211 --d->waitingWriters;-
212-
213 if (!success
!successDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
FALSEnever evaluated
)
0-1
214 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
1
215 }
never executed: end of block
0
216 if (d->recursive
d->recursiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QReadWriteLock
)
0-1
217 d->currentWriter = self;
never executed: d->currentWriter = self;
0
218-
219 --d->accessCount;-
220 ((!(d->accessCount < 0)) ? qt_assert_x("QReadWriteLock::tryLockForWrite()", "Overflow in lock counter",-
221 __FILE__-
222 ,-
223 393-
224 ) : qt_noop())-
225 ;-
226-
227 return
executed 1 time by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
true;
executed 1 time by 1 test: return true;
Executed by:
  • tst_QReadWriteLock
1
228}-
229void QReadWriteLock::unlock()-
230{-
231 QMutexLocker lock(&d->mutex);-
232-
233 ((!(d->accessCount != 0)) ? qt_assert_x("QReadWriteLock::unlock()", "Cannot unlock an unlocked lock",__FILE__,410) : qt_noop());-
234-
235 bool unlocked = false;-
236 if (d->accessCount > 0
d->accessCount > 0Description
TRUEevaluated 1685842 times by 357 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 330522 times by 564 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_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
) {
330522-1685842
237-
238 if (d->recursive
d->recursiveDescription
TRUEevaluated 105 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1685737 times by 357 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
  • ...
) {
105-1685737
239 Qt::HANDLE self = QThread::currentThreadId();-
240 QHash<Qt::HANDLE, int>::iterator it = d->currentReaders.find(self);-
241 if (it != d->currentReaders.end()
it != d->currentReaders.end()Description
TRUEevaluated 105 times by 5 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEnever evaluated
) {
0-105
242 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
)
19-86
243 d->currentReaders.erase(it);
executed 86 times by 5 tests: d->currentReaders.erase(it);
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
86
244 }
executed 105 times by 5 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
105
245 }
executed 105 times by 5 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QDirIterator
  • tst_QFile
  • tst_QReadWriteLock
  • tst_QWaitCondition
105
246-
247 unlocked = --d->accessCount == 0;-
248 }
executed 1685842 times by 357 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_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
  • ...
else if (d->accessCount < 0
d->accessCount < 0Description
TRUEevaluated 330522 times by 564 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_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
FALSEnever evaluated
&& ++
++d->accessCount == 0Description
TRUEevaluated 330510 times by 564 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_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 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
d->accessCount == 0
++d->accessCount == 0Description
TRUEevaluated 330510 times by 564 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_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 12 times by 2 tests
Evaluated by:
  • tst_QReadWriteLock
  • tst_QWaitCondition
) {
0-1685842
249-
250 unlocked = true;-
251 d->currentWriter = 0;-
252 }
executed 330510 times by 564 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_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
  • ...
330510
253-
254 if (unlocked
unlockedDescription
TRUEevaluated 1872432 times by 570 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_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 143932 times by 10 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QDBusConnection
  • tst_QDBusThreading
  • tst_QFile
  • tst_QHttpNetworkConnection
  • tst_QMetaType
  • tst_QNetworkReply
  • tst_QReadWriteLock
  • tst_QWaitCondition
  • tst_Spdy
) {
143932-1872432
255 if (d->waitingWriters
d->waitingWritersDescription
TRUEevaluated 6953 times by 5 tests
Evaluated by:
  • tst_QDBusConnection
  • tst_QDBusThreading
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1865479 times by 570 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_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
) {
6953-1865479
256 d->writerWait.wakeOne();-
257 }
executed 6953 times by 5 tests: end of block
Executed by:
  • tst_QDBusConnection
  • tst_QDBusThreading
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
else if (d->waitingReaders
d->waitingReadersDescription
TRUEevaluated 217 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
FALSEevaluated 1865262 times by 570 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_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAsn1Element
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
) {
217-1865262
258 d->readerWait.wakeAll();-
259 }
executed 217 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QReadWriteLock
  • tst_QWaitCondition
217
260 }
executed 1872432 times by 570 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_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
  • ...
1872432
261}
executed 2016364 times by 570 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_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
  • ...
2016364
262-
Switch to Source codePreprocessed file

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