39,6 → 39,9 |
|
static rwlock_t rwlock; |
|
static void writer(void *arg); |
static void failed(void); |
|
static void writer(void *arg) |
{ |
|
55,10 → 58,18 |
printf("Test passed.\n"); |
} |
|
char * test_rwlock2(void) |
static void failed() |
{ |
printf("Test failed prematurely.\n"); |
thread_exit(); |
} |
|
void test_rwlock2(void) |
{ |
thread_t *thrd; |
|
printf("Read/write locks test #2\n"); |
|
rwlock_initialize(&rwlock); |
|
rwlock_read_lock(&rwlock); |
70,14 → 81,14 |
if (thrd) |
thread_ready(thrd); |
else |
return "Could not create thread"; |
failed(); |
|
|
thread_sleep(1); |
|
rwlock_read_unlock(&rwlock); |
rwlock_read_unlock(&rwlock); |
rwlock_read_unlock(&rwlock); |
rwlock_read_unlock(&rwlock); |
|
return NULL; |
rwlock_read_unlock(&rwlock); |
|
} |