+static XBT_INLINE void lock_reset(xbt_mallocator_t m)
+{
+ m->lock = 0;
+}
+
+static XBT_INLINE void lock_acquire(xbt_mallocator_t m)
+{
+ if (initialization_done > 1) {
+ int *lock = &m->lock;
+ while (__sync_lock_test_and_set(lock, 1))
+ /* nop */;
+ }
+}
+
+static XBT_INLINE void lock_release(xbt_mallocator_t m)
+{
+ if (initialization_done > 1)
+ __sync_lock_release(&m->lock);
+}
+