thread/qmutexpool.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6static QMutexPool *globalMutexPool() { static QGlobalStatic<QMutexPool > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QMutexPool *x = new QMutexPool (QMutex::Recursive); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QMutexPool > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
executed: return thisGlobalStatic.pointer.load();
Execution Count:44701
partially evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33
evaluated: !thisGlobalStatic.pointer.load()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:44668
partially evaluated: !thisGlobalStatic.destroyed
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-44701
7QMutexPool::QMutexPool(QMutex::RecursionMode recursionMode, int size) -
8 : mutexes(size), recursionMode(recursionMode) -
9{ -
10 for (int index = 0; index < mutexes.count(); ++index) {
evaluated: index < mutexes.count()
TRUEFALSE
yes
Evaluation Count:4323
yes
Evaluation Count:33
33-4323
11 mutexes[index].store(0); -
12 }
executed: }
Execution Count:4323
4323
13}
executed: }
Execution Count:33
33
14 -
15 -
16 -
17 -
18 -
19QMutexPool::~QMutexPool() -
20{ -
21 for (int index = 0; index < mutexes.count(); ++index)
evaluated: index < mutexes.count()
TRUEFALSE
yes
Evaluation Count:29213
yes
Evaluation Count:223
223-29213
22 delete mutexes[index].load();
executed: delete mutexes[index].load();
Execution Count:29213
29213
23}
executed: }
Execution Count:223
223
24 -
25 -
26 -
27 -
28QMutexPool *QMutexPool::instance() -
29{ -
30 return globalMutexPool();
never executed: return globalMutexPool();
0
31} -
32QMutex *QMutexPool::createMutex(int index) -
33{ -
34 -
35 QMutex *newMutex = new QMutex(recursionMode); -
36 if (!mutexes[index].testAndSetRelease(0, newMutex))
partially evaluated: !mutexes[index].testAndSetRelease(0, newMutex)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:157
0-157
37 delete newMutex;
never executed: delete newMutex;
0
38 return mutexes[index].load();
executed: return mutexes[index].load();
Execution Count:157
157
39} -
40 -
41 -
42 -
43 -
44QMutex *QMutexPool::globalInstanceGet(const void *address) -
45{ -
46 QMutexPool * const globalInstance = globalMutexPool(); -
47 if (globalInstance == 0)
partially evaluated: globalInstance == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44701
0-44701
48 return 0;
never executed: return 0;
0
49 return globalInstance->get(address);
executed: return globalInstance->get(address);
Execution Count:44701
44701
50} -
51 -
52 -
53 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial