fix mt-mapperd pithos read bug. plus some minor fixes
[archipelago] / xseg / xtypes / xlock.h
index 54b6258..8b14302 100644 (file)
@@ -26,8 +26,14 @@ static inline unsigned long xlock_acquire(struct xlock *lock, unsigned long who)
        return who;
 }
 
+static inline unsigned long xlock_try_lock(struct xlock *lock, unsigned long who)
+{
+       return __sync_bool_compare_and_swap(&lock->owner, Noone, who);
+}
+
 static inline void xlock_release(struct xlock *lock)
 {
+       BARRIER();
        lock->owner = Noone;
 }