Rev 1221 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1221 | Rev 1658 | ||
---|---|---|---|
Line 71... | Line 71... | ||
71 | 71 | ||
72 | 72 | ||
73 | void writer(void *arg) |
73 | void writer(void *arg) |
74 | { |
74 | { |
75 | int rc, to; |
75 | int rc, to; |
- | 76 | thread_detach(THREAD); |
|
76 | waitq_sleep(&can_start); |
77 | waitq_sleep(&can_start); |
77 | 78 | ||
78 | to = random(40000); |
79 | to = random(40000); |
79 | printf("cpu%d, tid %d w+ (%d)\n", CPU->id, THREAD->tid, to); |
80 | printf("cpu%d, tid %d w+ (%d)\n", CPU->id, THREAD->tid, to); |
80 | rc = rwlock_write_lock_timeout(&rwlock, to); |
81 | rc = rwlock_write_lock_timeout(&rwlock, to); |
Line 93... | Line 94... | ||
93 | } |
94 | } |
94 | 95 | ||
95 | void reader(void *arg) |
96 | void reader(void *arg) |
96 | { |
97 | { |
97 | int rc, to; |
98 | int rc, to; |
- | 99 | thread_detach(THREAD); |
|
98 | waitq_sleep(&can_start); |
100 | waitq_sleep(&can_start); |
99 | 101 | ||
100 | to = random(2000); |
102 | to = random(2000); |
101 | printf("cpu%d, tid %d r+ (%d)\n", CPU->id, THREAD->tid, to); |
103 | printf("cpu%d, tid %d r+ (%d)\n", CPU->id, THREAD->tid, to); |
102 | rc = rwlock_read_lock_timeout(&rwlock, to); |
104 | rc = rwlock_read_lock_timeout(&rwlock, to); |