X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d8eb62b207b566949a0d9ce649a7b21e226b9168..08a29a4221dc5cec95b766cd9b25c95dcc361df9:/src/xbt/mallocator.c diff --git a/src/xbt/mallocator.c b/src/xbt/mallocator.c index 8e2b397649..3469e222e7 100644 --- a/src/xbt/mallocator.c +++ b/src/xbt/mallocator.c @@ -1,6 +1,6 @@ /* mallocator - recycle objects to avoid malloc() / free() */ -/* Copyright (c) 2006-2018. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2006-2019. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -46,13 +46,13 @@ static int initialization_done = 0; static inline void lock_reset(xbt_mallocator_t m) { - m->lock = 0; + atomic_flag_clear(&m->lock); } static inline void lock_acquire(xbt_mallocator_t m) { if (initialization_done > 1) { - while (__atomic_test_and_set(&m->lock, __ATOMIC_ACQUIRE)) + while (atomic_flag_test_and_set(&m->lock)) /* nop */; } } @@ -60,7 +60,7 @@ static inline void lock_acquire(xbt_mallocator_t m) static inline void lock_release(xbt_mallocator_t m) { if (initialization_done > 1) - __atomic_clear(&m->lock, __ATOMIC_RELEASE); + atomic_flag_clear(&m->lock); } /**