summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 */