apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i...@apache.org
Subject cvs commit: apr-util/test testqueue.c
Date Sat, 22 Feb 2003 17:02:49 GMT
ianh        2003/02/22 09:02:48

  Modified:    .        CHANGES
               include  apr_queue.h
               misc     apr_queue.c
               test     testqueue.c
  Log:
  API Change:
     * apr_queue_[try]pop now returns the item pushed, not a reference to it.
  
  previously if you weren't quick enough dealing with your pop'd data
  it would get overwritten by new values.
  
  Submitted by:	Paul Marquis <PMarquis@pobox.com
  Submitted by:   Jacob Lewallen <jlwalle@cs.ucr.edu>
  
  Revision  Changes    Path
  1.102     +3 -0      apr-util/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr-util/CHANGES,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- CHANGES	17 Feb 2003 00:16:43 -0000	1.101
  +++ CHANGES	22 Feb 2003 17:02:48 -0000	1.102
  @@ -1,5 +1,8 @@
   Changes with APR-util 0.9.2
   
  +  *) Queue overwrite, we now return the item pushed, not a reference to it. 
  +     [Paul Marquis <PMarquis@pobox.com, Jacob Lewallen <jlwalle@cs.ucr.edu>]
  +
     *) Remove include/apr_ldap.h on distclean.  PR 15592.  [Justin Erenkrantz]
   
     *) Fix race conditions in apr_queue.
  
  
  
  1.10      +2 -2      apr-util/include/apr_queue.h
  
  Index: apr_queue.h
  ===================================================================
  RCS file: /home/cvs/apr-util/include/apr_queue.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- apr_queue.h	13 Jan 2003 20:15:50 -0000	1.9
  +++ apr_queue.h	22 Feb 2003 17:02:48 -0000	1.10
  @@ -117,7 +117,7 @@
    * @returns APR_EOF if the queue has been terminated
    * @returns APR_SUCCESS on a successfull pop
    */
  -APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data);
  +APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void *data);
   
   /**
    * push/add a object to the queue, returning immediatly if the queue is full
  @@ -141,7 +141,7 @@
    * @returns APR_EOF the queue has been terminated
    * @returns APR_SUCCESS on a successfull push
    */
  -APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data);
  +APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void *data);
   
   /**
    * returns the size of the queue.
  
  
  
  1.12      +2 -2      apr-util/misc/apr_queue.c
  
  Index: apr_queue.c
  ===================================================================
  RCS file: /home/cvs/apr-util/misc/apr_queue.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- apr_queue.c	14 Feb 2003 04:39:07 -0000	1.11
  +++ apr_queue.c	22 Feb 2003 17:02:48 -0000	1.12
  @@ -333,7 +333,7 @@
           }
       } 
   
  -    *data = &queue->data[queue->out];
  +    *data = queue->data[queue->out];
       queue->nelts--;
   
       queue->out = (queue->out + 1) % queue->bounds;
  @@ -375,7 +375,7 @@
           return APR_EAGAIN;
       } 
   
  -    *data = &queue->data[queue->out];
  +    *data = queue->data[queue->out];
       queue->nelts--;
   
       queue->out = (queue->out + 1) % queue->bounds;
  
  
  
  1.5       +3 -3      apr-util/test/testqueue.c
  
  Index: testqueue.c
  ===================================================================
  RCS file: /home/cvs/apr-util/test/testqueue.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testqueue.c	14 Feb 2003 04:39:07 -0000	1.4
  +++ testqueue.c	22 Feb 2003 17:02:48 -0000	1.5
  @@ -90,7 +90,7 @@
       apr_queue_t *q = (apr_queue_t*)data;
       apr_status_t rv;
       int val;
  -    void*v;
  +    void *v;
   
       sleeprate = 1000000/consumer_activity;
       apr_sleep( (rand() % 4 ) * 1000000 ); /* sleep random seconds */
  @@ -111,7 +111,7 @@
               apr_thread_exit(thd, rv);
               return NULL;
           }
  -        val = **(int**)v;
  +        val = *(int*)v;
           if (verbose)
               fprintf(stderr,  "%ld\tpop %d\n", apr_os_thread_current(),val);
           apr_sleep( sleeprate ); /* sleep this long to acheive our rate */
  @@ -161,7 +161,7 @@
   
   static void usage(void)
   {
  -    fprintf(stderr,"usage: testqueue -p n -P n -c n -C n -q n -s n ");
  +    fprintf(stderr,"usage: testqueue -p n -P n -c n -C n -q n -s n\n");
       fprintf(stderr,"-c # of consumer\n");
       fprintf(stderr,"-C amount they consumer before dying\n");
       fprintf(stderr,"-p # of producers\n");
  
  
  

Mime
View raw message