| Line | Source | Count |
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | class QSemaphorePrivate { | - |
| 6 | public: | - |
| 7 | inline QSemaphorePrivate(int n) : avail(n) { }executed 1309342 times by 333 tests: end of blockExecuted 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
- ...
| 1309342 |
| 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__,112) : qt_noop()); | - |
| 24 | d = new QSemaphorePrivate(n); | - |
| 25 | }executed 1309342 times by 333 tests: end of blockExecuted 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
- ...
| 1309342 |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | | - |
| 33 | QSemaphore::~QSemaphore() | - |
| 34 | { delete d; }executed 1309353 times by 341 tests: end of blockExecuted 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
- ...
| 1309353 |
| 35 | void QSemaphore::acquire(int n) | - |
| 36 | { | - |
| 37 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::acquire", "parameter 'n' must be non-negative",__FILE__,134) : qt_noop()); | - |
| 38 | QMutexLocker locker(&d->mutex); | - |
| 39 | while (n > d->avail| TRUE | evaluated 732887 times by 198 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 3361823 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
- ...
|
) | 732887-3361823 |
| 40 | d->cond.wait(locker.mutex());executed 732887 times by 198 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
- ...
| 732887 |
| 41 | d->avail -= n; | - |
| 42 | }executed 3361823 times by 333 tests: end of blockExecuted 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
- ...
| 3361823 |
| 43 | void QSemaphore::release(int n) | - |
| 44 | { | - |
| 45 | ((!(n >= 0)) ? qt_assert_x("QSemaphore::release", "parameter 'n' must be non-negative",__FILE__,153) : qt_noop()); | - |
| 46 | QMutexLocker locker(&d->mutex); | - |
| 47 | d->avail += n; | - |
| 48 | d->cond.wakeAll(); | - |
| 49 | }executed 5078073 times by 334 tests: end of blockExecuted 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
- ...
| 5078073 |
| 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__,184) : qt_noop()); | - |
| 65 | QMutexLocker locker(&d->mutex); | - |
| 66 | if (n > d->avail| TRUE | 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__,210) : qt_noop()); | - |
| 74 | QMutexLocker locker(&d->mutex); | - |
| 75 | if (timeout < 0| TRUE | never evaluated | | FALSE | evaluated 1716267 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) { | 0-1716267 |
| 76 | while (n > d->avail| TRUE | 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->avail| TRUE | evaluated 188205 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| | FALSE | evaluated 1716244 times by 3 testsEvaluated by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) { | 188205-1716244 |
| 82 | const qint64 elapsed = timer.elapsed(); | - |
| 83 | if (timeout - elapsed <= 0| TRUE | evaluated 1 time by 1 test | | FALSE | evaluated 188204 times by 4 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
| 1-188204 |
| 84 | || !d->cond.wait(locker.mutex(), timeout - elapsed)| TRUE | evaluated 22 times by 3 testsEvaluated by:- tst_QReadWriteLock
- tst_QSemaphore
- tst_QThreadPool
| | FALSE | evaluated 188182 times by 3 testsEvaluated by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
|
) | 22-188182 |
| 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 188182 times by 3 tests: end of blockExecuted by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 188182 |
| 87 | }executed 1716244 times by 3 tests: end of blockExecuted by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 1716244 |
| 88 | d->avail -= n; | - |
| 89 | returnexecuted 1716244 times by 3 tests: return true;Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
true;executed 1716244 times by 3 tests: return true;Executed by:- tst_QSemaphore
- tst_QSslSocket
- tst_QThreadPool
| 1716244 |
| 90 | | - |
| 91 | | - |
| 92 | } | - |
| 93 | | - |
| 94 | | - |
| | |