vlmcd: Complete pending requests after "flushing"
[archipelago] / xseg / xtypes / xlock.h
index ce6ede0..17f8a17 100644 (file)
@@ -59,7 +59,8 @@
 
 struct xlock {
        unsigned long owner;
-} __attribute__ ((aligned (16))); /* support up to 128bit longs */
+};
+//} __attribute__ ((aligned (16))); /* support up to 128bit longs */
 
 static inline unsigned long xlock_acquire(struct xlock *lock, unsigned long who)
 {
@@ -110,7 +111,11 @@ static inline unsigned long xlock_acquire(struct xlock *lock, unsigned long who)
 
 static inline unsigned long xlock_try_lock(struct xlock *lock, unsigned long who)
 {
-       return __sync_bool_compare_and_swap(&lock->owner, Noone, who);
+       unsigned long owner;
+       owner = *(volatile unsigned long *)(&lock->owner);
+       if (owner == Noone)
+               return __sync_bool_compare_and_swap(&lock->owner, Noone, who);
+       return 0;
 }
 
 static inline void xlock_release(struct xlock *lock)