]> granicus.if.org Git - apache/commitdiff
be consistant about how a couple of members of mem_cache_object_t are used
authorGreg Ames <gregames@apache.org>
Mon, 10 Jun 2002 21:10:08 +0000 (21:10 +0000)
committerGreg Ames <gregames@apache.org>
Mon, 10 Jun 2002 21:10:08 +0000 (21:10 +0000)
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

modules/experimental/mod_mem_cache.c

index 5b6edfa75d9ee03d9778ad2149b3e0d6b62aad89..61d7d2d1e7acbf55a0c11c2275b2a31db2595bf1 100644 (file)
@@ -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)