Go to the source code of this file.
◆ DEF_TEST() [1/2]
DEF_TEST |
( |
SkSharedMutexBasic |
, |
|
|
r |
|
|
) |
| |
Definition at line 14 of file SkSharedMutexTest.cpp.
14 {
15 SkSharedMutex sm;
16 sm.acquire();
17 sm.assertHeld();
18 sm.release();
19 sm.acquireShared();
20 sm.assertHeldShared();
21 sm.releaseShared();
22}
◆ DEF_TEST() [2/2]
DEF_TEST |
( |
SkSharedMutexMultiThreaded |
, |
|
|
r |
|
|
) |
| |
Definition at line 24 of file SkSharedMutexTest.cpp.
24 {
25 SkSharedMutex sm;
26 static const int kSharedSize = 10;
27 int shared[kSharedSize];
29 for (
int i = 0;
i < kSharedSize; ++
i) {
31 }
33 if (threadIndex % 4 != 0) {
34 for (int c = 0; c < 100000; ++c) {
35 sm.acquireShared();
36 sm.assertHeldShared();
37 int v = shared[0];
38 for (
int i = 1;
i < kSharedSize; ++
i) {
40 }
41 sm.releaseShared();
42 }
43 } else {
44 for (int c = 0; c < 100000; ++c) {
45 sm.acquire();
46 sm.assertHeld();
48 for (
int i = 0;
i < kSharedSize; ++
i) {
50 }
51 sm.release();
52 }
53 }
54 });
55}
#define REPORTER_ASSERT(r, cond,...)
void batch(int N, std::function< void(int)> fn)