[CRIU] [PATCH 1/2] zdtm/lock: make futex_inc and futex_dec atomical

Andrey Vagin avagin at openvz.org
Tue Feb 25 03:11:17 PST 2014


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/lib/lock.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/lib/lock.h b/test/zdtm/lib/lock.h
index 00d6458..eb03990 100644
--- a/test/zdtm/lib/lock.h
+++ b/test/zdtm/lib/lock.h
@@ -83,10 +83,10 @@ static inline void futex_dec_and_wake(futex_t *f)
 }
 
 /* Plain increment futex @f value */
-static inline void futex_inc(futex_t *f) { f->raw++; }
+static inline void futex_inc(futex_t *f) { atomic_inc(&f->raw); }
 
 /* Plain decrement futex @f value */
-static inline void futex_dec(futex_t *f) { f->raw--; }
+static inline void futex_dec(futex_t *f) { atomic_dec(&f->raw); }
 
 /* Wait until futex @f value become @v */
 static inline void futex_wait_until(futex_t *f, uint32_t v)
-- 
1.8.5.3



More information about the CRIU mailing list