projects
/
archipelago
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix mt-mapperd pithos read bug. plus some minor fixes
[archipelago]
/
xseg
/
xtypes
/
xlock.h
diff --git
a/xseg/xtypes/xlock.h
b/xseg/xtypes/xlock.h
index
54b6258
..
8b14302
100644
(file)
--- a/
xseg/xtypes/xlock.h
+++ b/
xseg/xtypes/xlock.h
@@
-26,8
+26,14
@@
static inline unsigned long xlock_acquire(struct xlock *lock, unsigned long who)
return 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)
{
static inline void xlock_release(struct xlock *lock)
{
+ BARRIER();
lock->owner = Noone;
}
lock->owner = Noone;
}