Simplify atomicvar.h usage by having the mutex name implicit.

This commit is contained in:
antirez
2017-05-04 17:00:53 +02:00
parent 52bc74f221
commit 2a51bac44e
3 changed files with 25 additions and 27 deletions

View File

@ -74,7 +74,7 @@ void zlibc_free(void *ptr) {
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
atomicIncr(used_memory,__n,used_memory_mutex); \
atomicIncr(used_memory,__n); \
} else { \
used_memory += _n; \
} \
@ -84,7 +84,7 @@ void zlibc_free(void *ptr) {
size_t _n = (__n); \
if (_n&(sizeof(long)-1)) _n += sizeof(long)-(_n&(sizeof(long)-1)); \
if (zmalloc_thread_safe) { \
atomicDecr(used_memory,__n,used_memory_mutex); \
atomicDecr(used_memory,__n); \
} else { \
used_memory -= _n; \
} \
@ -222,7 +222,7 @@ size_t zmalloc_used_memory(void) {
size_t um;
if (zmalloc_thread_safe) {
atomicGet(used_memory,um,used_memory_mutex);
atomicGet(used_memory,um);
} else {
um = used_memory;
}