Subversion Repositories HelenOS-historic

Rev

Rev 1196 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1196 Rev 1658
Line 48... Line 48...
48
static void reader(void *arg);
48
static void reader(void *arg);
49
static void failed(void);
49
static void failed(void);
50
 
50
 
51
void writer(void *arg)
51
void writer(void *arg)
52
{
52
{
-
 
53
    thread_detach(THREAD);
-
 
54
 
53
    waitq_sleep(&can_start);
55
    waitq_sleep(&can_start);
54
 
56
 
55
    rwlock_write_lock(&rwlock);
57
    rwlock_write_lock(&rwlock);
56
    atomic_inc(&items_written);
58
    atomic_inc(&items_written);
57
    rwlock_write_unlock(&rwlock);
59
    rwlock_write_unlock(&rwlock);
58
}
60
}
59
 
61
 
60
void reader(void *arg)
62
void reader(void *arg)
61
{
63
{
-
 
64
    thread_detach(THREAD);
-
 
65
 
62
    waitq_sleep(&can_start);
66
    waitq_sleep(&can_start);
63
   
67
   
64
    rwlock_read_lock(&rwlock);
68
    rwlock_read_lock(&rwlock);
65
    atomic_inc(&items_read);
69
    atomic_inc(&items_read);
66
    rwlock_read_unlock(&rwlock);
70
    rwlock_read_unlock(&rwlock);