Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | QSystemSemaphore::QSystemSemaphore(const QString &key, int initialValue, AccessMode mode) | - |
4 | : d(new QSystemSemaphorePrivate) | - |
5 | { | - |
6 | setKey(key, initialValue, mode); | - |
7 | } executed: } Execution Count:47 | 47 |
8 | QSystemSemaphore::~QSystemSemaphore() | - |
9 | { | - |
10 | d->cleanHandle(); | - |
11 | } executed: } Execution Count:47 | 47 |
12 | void QSystemSemaphore::setKey(const QString &key, int initialValue, AccessMode mode) | - |
13 | { | - |
14 | if (key == d->key && mode == Open) evaluated: key == d->key yes Evaluation Count:4 | yes Evaluation Count:46 |
partially evaluated: mode == Open yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-46 |
15 | return; executed: return; Execution Count:4 | 4 |
16 | d->error = NoError; | - |
17 | d->errorString = QString(); | - |
18 | | - |
19 | | - |
20 | if (key == d->key && mode == Create && d->createdSemaphore && d->createdFile) { partially evaluated: key == d->key no Evaluation Count:0 | yes Evaluation Count:46 |
never evaluated: mode == Create never evaluated: d->createdSemaphore never evaluated: d->createdFile | 0-46 |
21 | d->initialValue = initialValue; | - |
22 | d->unix_key = -1; | - |
23 | d->handle(mode); | - |
24 | return; | 0 |
25 | } | - |
26 | | - |
27 | d->cleanHandle(); | - |
28 | d->key = key; | - |
29 | d->initialValue = initialValue; | - |
30 | | - |
31 | d->fileName = d->makeKeyFileName(); | - |
32 | d->handle(mode); | - |
33 | } executed: } Execution Count:46 | 46 |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | | - |
41 | QString QSystemSemaphore::key() const | - |
42 | { | - |
43 | return d->key; executed: return d->key; Execution Count:6 | 6 |
44 | } | - |
45 | bool QSystemSemaphore::acquire() | - |
46 | { | - |
47 | return d->modifySemaphore(-1); executed: return d->modifySemaphore(-1); Execution Count:5 | 5 |
48 | } | - |
49 | bool QSystemSemaphore::release(int n) | - |
50 | { | - |
51 | if (n == 0) partially evaluated: n == 0 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
52 | return true; never executed: return true; | 0 |
53 | if (n < 0) { partially evaluated: n < 0 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
54 | QMessageLogger("kernel/qsystemsemaphore.cpp", 306, __PRETTY_FUNCTION__).warning("QSystemSemaphore::release: n is negative."); | - |
55 | return false; never executed: return false; | 0 |
56 | } | - |
57 | return d->modifySemaphore(n); executed: return d->modifySemaphore(n); Execution Count:5 | 5 |
58 | } | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | | - |
64 | | - |
65 | | - |
66 | QSystemSemaphore::SystemSemaphoreError QSystemSemaphore::error() const | - |
67 | { | - |
68 | return d->error; executed: return d->error; Execution Count:9 | 9 |
69 | } | - |
70 | QString QSystemSemaphore::errorString() const | - |
71 | { | - |
72 | return d->errorString; executed: return d->errorString; Execution Count:8 | 8 |
73 | } | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
| | |