about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-30 08:03:44 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-30 08:03:44 +0000
commit085f2dd0ad1ba523749669b24f0999a3d1496ed7 (patch)
tree4ad5680dcbb22fd83a8a44dd5357bbc48a47963e /nscd
parent6037b7519a1975027dd1f9e0dbcb901c224972d8 (diff)
downloadglibc-085f2dd0ad1ba523749669b24f0999a3d1496ed7.tar.gz
glibc-085f2dd0ad1ba523749669b24f0999a3d1496ed7.tar.xz
glibc-085f2dd0ad1ba523749669b24f0999a3d1496ed7.zip
(__nscd_get_map_ref): Drop volatile from last parameter. (__nscd_drop_map_ref): Change second parameter to be a referenc to a variable. Update variable when cycle count changed.
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd-client.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/nscd/nscd-client.h b/nscd/nscd-client.h
index 930255cb81..2e7f27b8d5 100644
--- a/nscd/nscd-client.h
+++ b/nscd/nscd-client.h
@@ -276,20 +276,24 @@ extern int __nscd_open_socket (const char *key, size_t keylen,
 extern struct mapped_database *__nscd_get_map_ref (request_type type,
 						   const char *name,
 						   struct locked_map_ptr *mapptr,
-						   volatile int *gc_cyclep);
+						   int *gc_cyclep);
 
 /* Unmap database.  */
 extern void __nscd_unmap (struct mapped_database *mapped);
 
 /* Drop reference of mapping.  */
 static inline int __nscd_drop_map_ref (struct mapped_database *map,
-				       int gc_cycle)
+				       int *gc_cycle)
 {
   if (map != NO_MAPPING)
     {
-      if (__builtin_expect (map->head->gc_cycle != gc_cycle, 0))
-	/* We might have read inconsistent data.  */
-	return -1;
+      int now_cycle = map->head->gc_cycle;
+      if (__builtin_expect (now_cycle != *gc_cycle, 0))
+	{
+	  /* We might have read inconsistent data.  */
+	  *gc_cycle = now_cycle;
+	  return -1;
+	}
 
       if (atomic_decrement_val (&map->counter) == 0)
 	__nscd_unmap (map);