Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | class QSemaphorePrivate { | - |
6 | public: | - |
7 | inline QSemaphorePrivate(int n) : avail(n) { }executed 1373213 times by 333 tests: end of block Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 1373213 |
8 | | - |
9 | QMutex mutex; | - |
10 | QWaitCondition cond; | - |
11 | | - |
12 | int avail; | - |
13 | }; | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | QSemaphore::QSemaphore(int n) | - |
22 | { | - |
23 | ((!(n >= 0)) ? qt_assert_x("QSemaphore", "parameter 'n' must be non-negative",__FILE__,118) : qt_noop()); | - |
24 | d = new QSemaphorePrivate(n); | - |
25 | }executed 1373213 times by 333 tests: end of block Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 1373213 |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | QSemaphore::~QSemaphore() | - |
34 | { delete d; }executed 1373225 times by 342 tests: end of block Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 1373225 |
35 | void QSemaphore::acquire(int n) | - |
36 | { | - |
37 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::acquire", "parameter 'n' must be non-negative",__FILE__,140) : qt_noop()); | - |
38 | QMutexLocker locker(&d->mutex); | - |
39 | while (n > d->availTRUE | evaluated 553926 times by 200 testsEvaluated by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| FALSE | evaluated 3425674 times by 333 testsEvaluated by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
|
) | 553926-3425674 |
40 | d->cond.wait(locker.mutex());executed 553926 times by 200 tests: d->cond.wait(locker.mutex()); Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 553926 |
41 | d->avail -= n; | - |
42 | }executed 3425674 times by 333 tests: end of block Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 3425674 |
43 | void QSemaphore::release(int n) | - |
44 | { | - |
45 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::release", "parameter 'n' must be non-negative",__FILE__,159) : qt_noop()); | - |
46 | QMutexLocker locker(&d->mutex); | - |
47 | d->avail += n; | - |
48 | d->cond.wakeAll(); | - |
49 | }executed 5056536 times by 334 tests: end of block Executed by:- tst_Gestures
- tst_ModelTest
- tst_NetworkSelfTest
- tst_QAbstractButton
- tst_QAbstractItemView
- tst_QAbstractNetworkCache
- tst_QAbstractScrollArea
- tst_QAbstractSlider
- tst_QAbstractSpinBox
- tst_QAccessibility
- tst_QAction
- tst_QActionGroup
- tst_QApplication
- tst_QBackingStore
- tst_QBoxLayout
- tst_QButtonGroup
- tst_QCalendarWidget
- tst_QCheckBox
- tst_QColorDialog
- tst_QColumnView
- tst_QComboBox
- tst_QCommandLinkButton
- tst_QDBusAbstractAdaptor
- tst_QDBusAbstractInterface
- tst_QDBusConnection
- ...
| 5056536 |
50 | | - |
51 | | - |
52 | | - |
53 | | - |
54 | | - |
55 | | - |
56 | | - |
57 | int QSemaphore::available() const | - |
58 | { | - |
59 | QMutexLocker locker(&d->mutex); | - |
60 | returnexecuted 82 times by 2 tests: return d->avail; Executed by:- tst_QDBusThreading
- tst_QSemaphore
d->avail;executed 82 times by 2 tests: return d->avail; Executed by:- tst_QDBusThreading
- tst_QSemaphore
| 82 |
61 | } | - |
62 | bool QSemaphore::tryAcquire(int n) | - |
63 | { | - |
64 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::tryAcquire", "parameter 'n' must be non-negative",__FILE__,190) : qt_noop()); | - |
65 | QMutexLocker locker(&d->mutex); | - |
66 | if (n > d->availTRUE | evaluated 8 times by 1 test | FALSE | evaluated 4 times by 1 test |
) | 4-8 |
67 | returnexecuted 8 times by 1 test: return false; false;executed 8 times by 1 test: return false; | 8 |
68 | d->avail -= n; | - |
69 | returnexecuted 4 times by 1 test: return true; true;executed 4 times by 1 test: return true; | 4 |
70 | } | - |
71 | bool QSemaphore::tryAcquire(int n, int timeout) | - |
72 | { | - |
73 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::tryAcquire", "parameter 'n' must be non-negative",__FILE__,216) : qt_noop()); | - |
74 | QMutexLocker locker(&d->mutex); | - |
75 | if (timeout < 0TRUE | never evaluated | FALSE | evaluated 1630882 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) { | 0-1630882 |
76 | while (n > d->availTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
77 | d->cond.wait(locker.mutex()); never executed: d->cond.wait(locker.mutex()); | 0 |
78 | } never executed: end of block else { | 0 |
79 | QElapsedTimer timer; | - |
80 | timer.start(); | - |
81 | while (n > d->availTRUE | evaluated 194055 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| FALSE | evaluated 1630859 times by 3 testsEvaluated by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) { | 194055-1630859 |
82 | const qint64 elapsed = timer.elapsed(); | - |
83 | if (timeout - elapsed <= 0TRUE | evaluated 1 time by 1 test | FALSE | evaluated 194054 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
| 1-194054 |
84 | || !d->cond.wait(locker.mutex(), timeout - elapsed)TRUE | evaluated 22 times by 3 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QThreadPool
| FALSE | evaluated 194032 times by 3 testsEvaluated by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) | 22-194032 |
85 | returnexecuted 23 times by 3 tests: return false; Executed by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QThreadPool
false;executed 23 times by 3 tests: return false; Executed by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QThreadPool
| 23 |
86 | }executed 194032 times by 3 tests: end of block Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 194032 |
87 | }executed 1630859 times by 3 tests: end of block Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 1630859 |
88 | d->avail -= n; | - |
89 | returnexecuted 1630859 times by 3 tests: return true; Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
true;executed 1630859 times by 3 tests: return true; Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 1630859 |
90 | | - |
91 | | - |
92 | } | - |
93 | | - |
94 | | - |
| | |