Subversion Repositories HelenOS-historic

Rev

Rev 1104 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1104 Rev 1658
Line 49... Line 49...
49
static void producer(void *arg);
49
static void producer(void *arg);
50
static void failed(void);
50
static void failed(void);
51
 
51
 
52
void producer(void *arg)
52
void producer(void *arg)
53
{
53
{
-
 
54
    thread_detach(THREAD); 
-
 
55
 
54
    waitq_sleep(&can_start);
56
    waitq_sleep(&can_start);
55
       
57
       
56
    semaphore_down(&sem);
58
    semaphore_down(&sem);
57
    atomic_inc(&items_produced);
59
    atomic_inc(&items_produced);
58
    thread_usleep(250);
60
    thread_usleep(250);
59
    semaphore_up(&sem);
61
    semaphore_up(&sem);
60
}
62
}
61
 
63
 
62
void consumer(void *arg)
64
void consumer(void *arg)
63
{
65
{
-
 
66
    thread_detach(THREAD); 
-
 
67
   
64
    waitq_sleep(&can_start);
68
    waitq_sleep(&can_start);
65
   
69
   
66
    semaphore_down(&sem);
70
    semaphore_down(&sem);
67
    atomic_inc(&items_consumed);
71
    atomic_inc(&items_consumed);
68
    thread_usleep(500);
72
    thread_usleep(500);