| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/thread/qmutexpool.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | namespace { namespace Q_QGS_globalMutexPool { typedef QMutexPool Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
executed 16 times by 16 tests: }guard.store(QtGlobalStatic::Destroyed);Executed by:
executed 16 times by 16 tests: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (QMutex::Recursive))) : value (QMutex::Recursive) { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blockExecuted by:
executed 143976 times by 32 tests: &holder.value;return &holder.value;Executed by:
executed 143976 times by 32 tests: } } } static QGlobalStatic<QMutexPool, Q_QGS_globalMutexPool::innerFunction, Q_QGS_globalMutexPool::guard> globalMutexPool;return &holder.value;Executed by:
| 0-143976 | ||||||
| 7 | QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) | - | ||||||
| 8 | : mutexes(size), recursionMode(recursionMode) | - | ||||||
| 9 | { | - | ||||||
| 10 | for (int index = 0; index < mutexes.count()
| 16-2096 | ||||||
| 11 | mutexes[index].store(0); | - | ||||||
| 12 | } executed 2096 times by 16 tests: end of blockExecuted by:
| 2096 | ||||||
| 13 | } executed 16 times by 16 tests: end of blockExecuted by:
| 16 | ||||||
| 14 | - | |||||||
| 15 | - | |||||||
| 16 | - | |||||||
| 17 | - | |||||||
| 18 | - | |||||||
| 19 | QMutexPool::~QMutexPool() | - | ||||||
| 20 | { | - | ||||||
| 21 | for (int index = 0; index < mutexes.count()
| 16-2096 | ||||||
| 22 | delete mutexes[index].load(); executed 2096 times by 16 tests: delete mutexes[index].load();Executed by:
| 2096 | ||||||
| 23 | } executed 16 times by 16 tests: end of blockExecuted by:
| 16 | ||||||
| 24 | - | |||||||
| 25 | - | |||||||
| 26 | - | |||||||
| 27 | - | |||||||
| 28 | QMutexPool *QMutexPool::instance() | - | ||||||
| 29 | { | - | ||||||
| 30 | return never executed: globalMutexPool();return globalMutexPool();never executed: return globalMutexPool(); | 0 | ||||||
| 31 | } | - | ||||||
| 32 | QMutex *QMutexPool::createMutex(int index) | - | ||||||
| 33 | { | - | ||||||
| 34 | - | |||||||
| 35 | QMutex *newMutex = new QMutex(recursionMode); | - | ||||||
| 36 | if (!mutexes[index].testAndSetRelease(0, newMutex)
| 0-340 | ||||||
| 37 | delete newMutex; never executed: delete newMutex; | 0 | ||||||
| 38 | return executed 340 times by 17 tests: mutexes[index].load();return mutexes[index].load();Executed by:
executed 340 times by 17 tests: return mutexes[index].load();Executed by:
| 340 | ||||||
| 39 | } | - | ||||||
| 40 | - | |||||||
| 41 | - | |||||||
| 42 | - | |||||||
| 43 | - | |||||||
| 44 | QMutex *QMutexPool::globalInstanceGet(const void *address) | - | ||||||
| 45 | { | - | ||||||
| 46 | QMutexPool * const globalInstance = globalMutexPool(); | - | ||||||
| 47 | if (globalInstance == 0
| 0-143976 | ||||||
| 48 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||
| 49 | return executed 143976 times by 32 tests: globalInstance->get(address);return globalInstance->get(address);Executed by:
executed 143976 times by 32 tests: return globalInstance->get(address);Executed by:
| 143976 | ||||||
| 50 | } | - | ||||||
| 51 | - | |||||||
| 52 | - | |||||||
| Switch to Source code | Preprocessed file |