Rev 2787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2787 | Rev 3424 | ||
---|---|---|---|
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 %llu: trying to lock rwlock for reading....\n", CPU->id, THREAD->tid); |
48 | printf("cpu%u, tid %" PRIu64 ": 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 %llu: success\n", CPU->id, THREAD->tid); |
54 | printf("cpu%u, tid %" PRIu64 ": success\n", CPU->id, THREAD->tid); |
55 | printf("cpu%d, tid %llu: trying to lock rwlock for writing....\n", CPU->id, THREAD->tid); |
55 | printf("cpu%u, tid %" PRIu64 ": 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 %llu: success\n", CPU->id, THREAD->tid); |
62 | printf("cpu%u, tid %" PRIu64 ": 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) |
Line 86... | Line 86... | ||
86 | thread_sleep(1); |
86 | thread_sleep(1); |
87 | rwlock_write_unlock(&rwlock); |
87 | rwlock_write_unlock(&rwlock); |
88 | 88 | ||
89 | while (atomic_get(&thread_count) > 0) { |
89 | while (atomic_get(&thread_count) > 0) { |
90 | if (!quiet) |
90 | if (!quiet) |
91 | printf("Threads left: %d\n", atomic_get(&thread_count)); |
91 | printf("Threads left: %ld\n", atomic_get(&thread_count)); |
92 | thread_sleep(1); |
92 | thread_sleep(1); |
93 | } |
93 | } |
94 | 94 | ||
95 | return NULL; |
95 | return NULL; |
96 | } |
96 | } |