rbb         99/02/20 19:20:05

  Modified:    pthreads/src/main fdqueue.c
  Log:
  We actually want to signal a thread everytime we add something to the
  fdqueue, not just when the queue was empty before we added it.  This
  was resulting in a bug where only one thread was ever actually working on a
  request, and when that request was done, it would get the next request and
  serve it.  Not the most efficient algorithm.  This should fix it.  I tested
  it as best as possible, but Monday I'll test it better.
  
  Revision  Changes    Path
  1.8       +1 -5      apache-apr/pthreads/src/main/fdqueue.c
  
  Index: fdqueue.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- fdqueue.c 1999/02/19 20:33:22     1.7
  +++ fdqueue.c 1999/02/21 03:20:05     1.8
  @@ -31,13 +31,9 @@
       }
       queue->data[queue->tail].fd = fd;
       queue->data[queue->tail].addr = *addr;
  -    /* If the queue was empty, signal that it no longer is.  We use
  -       bounds-1 because of annoying allocation logic. */
  -    if (queue->blanks >= queue->bounds - 1) {
  -        pthread_cond_signal(&queue->not_empty);
  -    }
       queue->tail = (queue->tail + 1) % queue->bounds;
       queue->blanks--;
  +    pthread_cond_signal(&queue->not_empty);
       if (queue->blanks == 0) {
           pthread_cond_wait(&queue->not_full, &queue->one_big_mutex);
       }
  
  
  

Reply via email to