I think the Thread Safe FIFO bounded queue has a bug in the various pop() functions. The data returned in these functions is set to the address of the internal array used for storing the queued objects. The returned data should be what's passed in via a previous call to one of the push() functions.

Here is a patch (this breaks test/testqueue.c, which seems odd to me).

--- misc/apr_queue.c.orig       Mon Jan 13 15:15:50 2003
+++ misc/apr_queue.c    Tue Jan 28 13:11:18 2003
@@ -340,7 +340,7 @@
         need_signal = 1;
     }

-    *data = &queue->data[queue->out];
+    *data = queue->data[queue->out];
     queue->nelts--;

     queue->out = (queue->out + 1) % queue->bounds;
@@ -386,7 +386,7 @@
         need_signal = 1;
     }

-    *data = &queue->data[queue->out];
+    *data = queue->data[queue->out];
     queue->nelts--;

     queue->out = (queue->out + 1) % queue->bounds;

--
Paul Marquis
[EMAIL PROTECTED]



Reply via email to