From: Greg Ames Date: Mon, 10 Jun 2002 21:10:08 +0000 (+0000) Subject: be consistant about how a couple of members of mem_cache_object_t are used X-Git-Tag: 2.0.37~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3bbb78fab13a386199a1c7c2b776c13d0b5327c;p=apache be consistant about how a couple of members of mem_cache_object_t are used and defined to silence compile errors on a system where apr_atomic_t is a structure. "pos" is read & written with atomic operators, so make it an apr_atomic_t. "priority" is almost always updated without using atomic operators, so I assume it doesn't need to be atomic. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95597 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index 5b6edfa75d..61d7d2d1e7 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -98,7 +98,13 @@ typedef struct mem_cache_object { apr_os_file_t fd; long priority; /**< the priority of this entry */ long total_refs; /**< total number of references this entry has had */ - apr_ssize_t pos; /**< the position of this entry in the cache */ + +#ifdef USE_ATOMICS + apr_atomic_t pos; /**< the position of this entry in the cache */ +#else + apr_ssize_t pos; +#endif + } mem_cache_object_t; typedef struct { @@ -137,12 +143,7 @@ static long memcache_get_priority(void*a) cache_object_t *obj = (cache_object_t *)a; mem_cache_object_t *mobj = obj->vobj; -#ifdef USE_ATOMICS - return (long)apr_atomic_read(&mobj->priority); -#else return mobj->priority; -#endif - } static void memcache_inc_frequency(void*a)