Mercurial > libjeffpc > experimental
annotate tests/test_rwlock-unlock-destroyed.c @ 945:d83ac58d2500
synch: add rwlock tests
Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author | Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
---|---|
date | Sun, 11 Aug 2019 12:18:09 -0400 |
parents | tests/test_mutex-unlock-destroyed.c@f052dc63be28 |
children |
rev | line source |
---|---|
742
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
1 /* |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
2 * Copyright (c) 2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net> |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
3 * |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
4 * Permission is hereby granted, free of charge, to any person obtaining a copy |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
5 * of this software and associated documentation files (the "Software"), to deal |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
6 * in the Software without restriction, including without limitation the rights |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
8 * copies of the Software, and to permit persons to whom the Software is |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
9 * furnished to do so, subject to the following conditions: |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
10 * |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
11 * The above copyright notice and this permission notice shall be included in |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
12 * all copies or substantial portions of the Software. |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
13 * |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
20 * SOFTWARE. |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
21 */ |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
22 |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
23 #include <jeffpc/synch.h> |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
24 |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
25 #include "test.c" |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
26 |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
27 void test(void) |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
28 { |
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
29 LOCK_CLASS(lc); |
945
d83ac58d2500
synch: add rwlock tests
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
742
diff
changeset
|
30 struct rwlock a; |
742
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
31 |
945
d83ac58d2500
synch: add rwlock tests
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
742
diff
changeset
|
32 RWINIT(&a, &lc); |
d83ac58d2500
synch: add rwlock tests
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
742
diff
changeset
|
33 RWDESTROY(&a); |
742
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
34 |
945
d83ac58d2500
synch: add rwlock tests
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
742
diff
changeset
|
35 test_set_panic_string("lockdep: Aborting - bad rwlock magic"); |
742
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
36 |
945
d83ac58d2500
synch: add rwlock tests
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
742
diff
changeset
|
37 RWUNLOCK(&a); |
742
f052dc63be28
synch: clear the lock magic when when destroying it
Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
parents:
diff
changeset
|
38 } |