From: Simon Marlow Date: Fri, 6 Feb 2009 13:01:30 +0000 (+0000) Subject: add a single-threaded version of cas() X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=5f7079b97e322fd84e99adb686c86afe6d7c8231;p=ghc-hetmet.git add a single-threaded version of cas() --- diff --git a/includes/SMP.h b/includes/SMP.h index 5d74667..49bc336 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 */