Rev 1787 | Rev 2028 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1787 | Rev 2022 | ||
|---|---|---|---|
| Line 40... | Line 40... | ||
| 40 | static rwlock_t rwlock; |
40 | static rwlock_t rwlock; |
| 41 | 41 | ||
| 42 | static void reader(void *arg); |
42 | static void reader(void *arg); |
| 43 | static void failed(void); |
43 | static void failed(void); |
| 44 | 44 | ||
| 45 | void reader(void *arg) |
45 | static void reader(void *arg) |
| 46 | { |
46 | { |
| 47 | thread_detach(THREAD); |
47 | thread_detach(THREAD); |
| 48 | 48 | ||
| 49 | printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
49 | printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
| 50 | rwlock_read_lock(&rwlock); |
50 | rwlock_read_lock(&rwlock); |
| Line 59... | Line 59... | ||
| 59 | 59 | ||
| 60 | printf("Test passed.\n"); |
60 | printf("Test passed.\n"); |
| 61 | 61 | ||
| 62 | } |
62 | } |
| 63 | 63 | ||
| 64 | void failed(void) |
64 | static void failed(void) |
| 65 | { |
65 | { |
| 66 | printf("Test failed prematurely.\n"); |
66 | printf("Test failed prematurely.\n"); |
| 67 | thread_exit(); |
67 | thread_exit(); |
| 68 | } |
68 | } |
| 69 | 69 | ||
| 70 | void test(void) |
70 | void test_rwlock3(void) |
| 71 | { |
71 | { |
| 72 | int i; |
72 | int i; |
| 73 | thread_t *thrd; |
73 | thread_t *thrd; |
| 74 | 74 | ||
| 75 | printf("Read/write locks test #3\n"); |
75 | printf("Read/write locks test #3\n"); |