From c3634fd742f0a1acb3303fd77498b10f8d6bcf54 Mon Sep 17 00:00:00 2001 From: Chris Darroch Date: Wed, 5 Mar 2008 22:08:25 +0000 Subject: [PATCH] add comment from event MPM's fdqueue ap_pop_pool() regarding ABA problem and avoidance because only caller is single listener thread git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@634050 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/worker/fdqueue.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/mpm/worker/fdqueue.c b/server/mpm/worker/fdqueue.c index 8a75d24d1ed..d46dd5361bd 100644 --- a/server/mpm/worker/fdqueue.c +++ b/server/mpm/worker/fdqueue.c @@ -188,6 +188,14 @@ apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info, apr_atomic_dec32(&(queue_info->idlers)); /* Atomically pop a pool from the recycled list */ + + /* This function is safe only as long as it is single threaded because + * it reaches into the queue and accesses "next" which can change. + * We are OK today because it is only called from the listener thread. + * cas-based pushes do not have the same limitation - any number can + * happen concurrently with a single cas-based pop. + */ + for (;;) { struct recycled_pool *first_pool = queue_info->recycled_pools; if (first_pool == NULL) { -- 2.47.2