From: Yann Ylavic Date: Thu, 22 Jul 2021 15:04:26 +0000 (+0000) Subject: mpm_event: use apr_atomic_read32() to read queues' ->total instead of volatile access. X-Git-Tag: 2.5.0-alpha2-ci-test-only~888 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ca50b49355e5db5b121b7abb724158119ae9097;p=thirdparty%2Fapache%2Fhttpd.git mpm_event: use apr_atomic_read32() to read queues' ->total instead of volatile access. * server/mpm/event/event.c (listener_thread): Use apr_atomic_read32() instead open coded *(volatile apr_uint32_t*)q->total. No functional change. Follow up to r1891716. Github: #208 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1891718 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index b43b05ebe7d..1f3d751a9ad 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -1895,8 +1895,8 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) "keep-alive: %d lingering: %d suspended: %u)", apr_atomic_read32(&connection_count), apr_atomic_read32(&clogged_count), - *(volatile apr_uint32_t*)write_completion_q->total, - *(volatile apr_uint32_t*)keepalive_q->total, + apr_atomic_read32(write_completion_q->total), + apr_atomic_read32(keepalive_q->total), apr_atomic_read32(&lingering_count), apr_atomic_read32(&suspended_count)); if (dying) { @@ -2260,14 +2260,14 @@ do_maintenance: queues_next_expiry > now ? queues_next_expiry - now : -1); - ps->keep_alive = *(volatile apr_uint32_t*)keepalive_q->total; - ps->write_completion = *(volatile apr_uint32_t*)write_completion_q->total; + ps->keep_alive = apr_atomic_read32(keepalive_q->total); + ps->write_completion = apr_atomic_read32(write_completion_q->total); ps->connections = apr_atomic_read32(&connection_count); ps->suspended = apr_atomic_read32(&suspended_count); ps->lingering_close = apr_atomic_read32(&lingering_count); } else if ((workers_were_busy || dying) - && *(volatile apr_uint32_t*)keepalive_q->total) { + && apr_atomic_read32(keepalive_q->total)) { apr_thread_mutex_lock(timeout_mutex); process_keepalive_queue(0); /* kill'em all \m/ */ apr_thread_mutex_unlock(timeout_mutex);