Rev 2071 | Rev 3069 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2071 | Rev 2216 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | static void reader(void *arg) |
43 | static void reader(void *arg) |
| 44 | { |
44 | { |
| 45 | thread_detach(THREAD); |
45 | thread_detach(THREAD); |
| 46 | 46 | ||
| 47 | if (!sh_quiet) |
47 | if (!sh_quiet) |
| 48 | printf("cpu%d, tid %d: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
48 | printf("cpu%d, tid %llu: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
| 49 | 49 | ||
| 50 | rwlock_read_lock(&rwlock); |
50 | rwlock_read_lock(&rwlock); |
| 51 | rwlock_read_unlock(&rwlock); |
51 | rwlock_read_unlock(&rwlock); |
| 52 | 52 | ||
| 53 | if (!sh_quiet) { |
53 | if (!sh_quiet) { |
| 54 | printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid); |
54 | printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); |
| 55 | printf("cpu%d, tid %d: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); |
55 | printf("cpu%d, tid %llu: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); |
| 56 | } |
56 | } |
| 57 | 57 | ||
| 58 | rwlock_write_lock(&rwlock); |
58 | rwlock_write_lock(&rwlock); |
| 59 | rwlock_write_unlock(&rwlock); |
59 | rwlock_write_unlock(&rwlock); |
| 60 | 60 | ||
| 61 | if (!sh_quiet) |
61 | if (!sh_quiet) |
| 62 | printf("cpu%d, tid %d: success\n", CPU->id, THREAD->tid); |
62 | printf("cpu%d, tid %llu: success\n", CPU->id, THREAD->tid); |
| 63 | 63 | ||
| 64 | atomic_dec(&thread_count); |
64 | atomic_dec(&thread_count); |
| 65 | } |
65 | } |
| 66 | 66 | ||
| 67 | char * test_rwlock3(bool quiet) |
67 | char * test_rwlock3(bool quiet) |