Changeset 8


Ignore:
Timestamp:
Apr 22, 2011, 9:37:36 AM (8 years ago)
Author:
monga
Message:

Incrementers and watcher

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pthreads-pc.c

    r2 r8  
    5555  pthread_mutex_lock(&lock);
    5656
    57   if (count == N) pthread_cond_wait(&full, &lock);
     57  while (count == N) pthread_cond_wait(&full, &lock);
    5858  buffer[count++] = o;
    5959  if (count == 1) pthread_cond_signal(&empty);
     
    6767  pthread_mutex_lock(&lock);
    6868
    69   if (count == 0) pthread_cond_wait(&empty, &lock);
     69  while (count == 0) pthread_cond_wait(&empty, &lock);
    7070  *result = buffer[--count];
    7171  if (count == N-1) pthread_cond_signal(&full);
Note: See TracChangeset for help on using the changeset viewer.