Lazyfree: fix lazyfreeGetPendingObjectsCount() race reading counter.

This commit is contained in:
antirez committed 2017-05-04 10:35:40 +02:00
1 parent 5d0925796b
commit 300308d200
1 file changed
+3 -1
+3 -1
View File
@@ -8,7 +8,9 @@ pthread_mutex_t lazyfree_objects_mutex = PTHREAD_MUTEX_INITIALIZER;
/* Return the number of currently pending objects to free. */
size_t lazyfreeGetPendingObjectsCount(void) {
return lazyfree_objects;
size_t aux;
atomicGet(lazyfree_objects,aux,lazyfree_objects_mutex);
return aux;
}
/* Return the amount of work needed in order to free an object.