From c9eb9be4745bf47e01fa65a672235f21844742b7 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sun, 16 Nov 2003 01:51:28 +0000 Subject: [PATCH] stop using deprecated apr_atomic functions git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@101786 13f79535-47bb-0310-9956-ffa450edef68 --- modules/experimental/mod_mem_cache.c | 22 +++++++++++----------- server/mpm/experimental/leader/leader.c | 18 +++++++++--------- server/mpm/winnt/child.c | 12 ++++++------ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index 37831deef7..138693673a 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -168,7 +168,7 @@ static void memcache_set_pos(void *a, apr_ssize_t pos) mem_cache_object_t *mobj = obj->vobj; #ifdef USE_ATOMICS - apr_atomic_set(&mobj->pos, pos); + apr_atomic_set32(&mobj->pos, pos); #else mobj->pos = pos; #endif @@ -179,7 +179,7 @@ static apr_ssize_t memcache_get_pos(void *a) mem_cache_object_t *mobj = obj->vobj; #ifdef USE_ATOMICS - return apr_atomic_read(&mobj->pos); + return apr_atomic_read32(&mobj->pos); #else return mobj->pos; #endif @@ -213,7 +213,7 @@ static void memcache_cache_free(void*a) * condition. A similar pattern is used in remove_url() */ #ifdef USE_ATOMICS - apr_atomic_inc(&obj->refcount); + apr_atomic_inc32(&obj->refcount); #else obj->refcount++; #endif @@ -221,7 +221,7 @@ static void memcache_cache_free(void*a) obj->cleanup = 1; #ifdef USE_ATOMICS - if (!apr_atomic_dec(&obj->refcount)) { + if (!apr_atomic_dec32(&obj->refcount)) { cleanup_cache_object(obj); } #else @@ -357,7 +357,7 @@ static apr_status_t decrement_refcount(void *arg) /* Cleanup the cache object */ #ifdef USE_ATOMICS - if (!apr_atomic_dec(&obj->refcount)) { + if (!apr_atomic_dec32(&obj->refcount)) { if (obj->cleanup) { cleanup_cache_object(obj); } @@ -399,9 +399,9 @@ static apr_status_t cleanup_cache_mem(void *sconfv) /* Iterate over the cache and clean up each entry */ /* Free the object if the recount == 0 */ #ifdef USE_ATOMICS - apr_atomic_inc(&obj->refcount); + apr_atomic_inc32(&obj->refcount); obj->cleanup = 1; - if (!apr_atomic_dec(&obj->refcount)) { + if (!apr_atomic_dec32(&obj->refcount)) { #else obj->cleanup = 1; if (!obj->refcount) { @@ -517,7 +517,7 @@ static int create_entity(cache_handle_t *h, request_rec *r, /* Finish initing the cache object */ #ifdef USE_ATOMICS - apr_atomic_set(&obj->refcount, 1); + apr_atomic_set32(&obj->refcount, 1); #else obj->refcount = 1; #endif @@ -595,7 +595,7 @@ static int open_entity(cache_handle_t *h, request_rec *r, const char *type, cons if (obj->complete) { request_rec *rmain=r, *rtmp; #ifdef USE_ATOMICS - apr_atomic_inc(&obj->refcount); + apr_atomic_inc32(&obj->refcount); #else obj->refcount++; #endif @@ -758,7 +758,7 @@ static int remove_url(const char *type, const char *key) /* Refcount increment in this case MUST be made under * protection of the lock */ - apr_atomic_inc(&obj->refcount); + apr_atomic_inc32(&obj->refcount); #else if (!obj->refcount) { cleanup_cache_object(obj); @@ -774,7 +774,7 @@ static int remove_url(const char *type, const char *key) } #ifdef USE_ATOMICS if (obj) { - if (!apr_atomic_dec(&obj->refcount)) { + if (!apr_atomic_dec32(&obj->refcount)) { cleanup_cache_object(obj); } } diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index e32f1ddd75..37d9bfae28 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -273,7 +273,7 @@ static worker_wakeup_info *worker_wakeup_create(apr_pool_t *pool) */ typedef struct { /* 'state' consists of several fields concatenated into a - * single 32-bit int for use with the apr_atomic_cas() API: + * single 32-bit int for use with the apr_atomic_cas32() API: * state & STACK_FIRST is the thread ID of the first thread * in a linked list of idle threads * state & STACK_TERMINATED indicates whether the proc is shutting down @@ -308,7 +308,7 @@ static apr_status_t worker_stack_wait(worker_stack *stack, if (state & STACK_TERMINATED) { return APR_EINVAL; } - if (apr_atomic_cas(&(stack->state), STACK_LIST_END, state) != + if (apr_atomic_cas32(&(stack->state), STACK_LIST_END, state) != state) { continue; } @@ -317,7 +317,7 @@ static apr_status_t worker_stack_wait(worker_stack *stack, } } wakeup->next = state; - if (apr_atomic_cas(&(stack->state), worker_id, state) != state) { + if (apr_atomic_cas32(&(stack->state), worker_id, state) != state) { continue; } else { @@ -333,8 +333,8 @@ static apr_status_t worker_stack_awaken_next(worker_stack *stack) apr_uint32_t state = stack->state; apr_uint32_t first = state & STACK_FIRST; if (first == STACK_LIST_END) { - if (apr_atomic_cas(&(stack->state), state | STACK_NO_LISTENER, - state) != state) { + if (apr_atomic_cas32(&(stack->state), state | STACK_NO_LISTENER, + state) != state) { continue; } else { @@ -343,8 +343,8 @@ static apr_status_t worker_stack_awaken_next(worker_stack *stack) } else { worker_wakeup_info *wakeup = worker_wakeups[first]; - if (apr_atomic_cas(&(stack->state), (state ^ first) | wakeup->next, - state) != state) { + if (apr_atomic_cas32(&(stack->state), (state ^ first) | wakeup->next, + state) != state) { continue; } else { @@ -373,8 +373,8 @@ static apr_status_t worker_stack_term(worker_stack *stack) while (1) { apr_uint32_t state = stack->state; - if (apr_atomic_cas(&(stack->state), state | STACK_TERMINATED, - state) == state) { + if (apr_atomic_cas32(&(stack->state), state | STACK_TERMINATED, + state) == state) { break; } } diff --git a/server/mpm/winnt/child.c b/server/mpm/winnt/child.c index 841fa8bc75..f1034f6c94 100644 --- a/server/mpm/winnt/child.c +++ b/server/mpm/winnt/child.c @@ -206,7 +206,7 @@ AP_DECLARE(PCOMP_CONTEXT) mpm_get_completion_context(void) context->accept_socket = INVALID_SOCKET; context->ba = apr_bucket_alloc_create(pchild); - apr_atomic_inc(&num_completion_contexts); + apr_atomic_inc32(&num_completion_contexts); break; } } else { @@ -671,10 +671,10 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context) mpm_recycle_completion_context(context); - apr_atomic_inc(&g_blocked_threads); + apr_atomic_inc32(&g_blocked_threads); while (1) { if (workers_may_exit) { - apr_atomic_dec(&g_blocked_threads); + apr_atomic_dec32(&g_blocked_threads); return NULL; } rc = GetQueuedCompletionStatus(ThreadDispatchIOCP, &BytesRead, &CompKey, @@ -691,15 +691,15 @@ static PCOMP_CONTEXT winnt_get_connection(PCOMP_CONTEXT context) context = CONTAINING_RECORD(pol, COMP_CONTEXT, Overlapped); break; case IOCP_SHUTDOWN: - apr_atomic_dec(&g_blocked_threads); + apr_atomic_dec32(&g_blocked_threads); return NULL; default: - apr_atomic_dec(&g_blocked_threads); + apr_atomic_dec32(&g_blocked_threads); return NULL; } break; } - apr_atomic_dec(&g_blocked_threads); + apr_atomic_dec32(&g_blocked_threads); return context; } -- 2.50.1