summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-02-06 13:01:30 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-02-06 13:01:30 +0000
commit5f7079b97e322fd84e99adb686c86afe6d7c8231 (patch)
treec2730a29b718b5e1294b86990d191d29810f9f85 /includes
parentaee6d6898bdb8294637df4aa0ef824b268c55a01 (diff)
downloadhaskell-5f7079b97e322fd84e99adb686c86afe6d7c8231.tar.gz
add a single-threaded version of cas()
Diffstat (limited to 'includes')
-rw-r--r--includes/SMP.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/includes/SMP.h b/includes/SMP.h
index 5d74667f86..49bc336f99 100644
--- a/includes/SMP.h
+++ b/includes/SMP.h
@@ -218,6 +218,17 @@ xchg(StgPtr p, StgWord w)
return old;
}
+STATIC_INLINE StgWord
+cas(StgVolatilePtr p, StgWord o, StgWord n)
+{
+ StgWord result;
+ result = *p;
+ if (result == o) {
+ *p = n;
+ }
+ return result;
+}
+
#endif /* !THREADED_RTS */
#endif /* SMP_H */