summaryrefslogtreecommitdiff
path: root/rts/SMPClosureOps.h
diff options
context:
space:
mode:
Diffstat (limited to 'rts/SMPClosureOps.h')
-rw-r--r--rts/SMPClosureOps.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/rts/SMPClosureOps.h b/rts/SMPClosureOps.h
index f5242a9cf1..d0b9e9ce5b 100644
--- a/rts/SMPClosureOps.h
+++ b/rts/SMPClosureOps.h
@@ -16,7 +16,9 @@
* Arguments are swapped for uniformity with unlockClosure. */
#if defined(THREADED_RTS)
#define LOCK_CLOSURE(closure, info) \
- if (CInt[n_capabilities] == 1 :: CInt) { \
+ CInt _n_caps; \
+ _n_caps = %relaxed CInt[n_capabilities]; \
+ if (_n_caps == 1 :: CInt) { \
info = GET_INFO(closure); \
} else { \
("ptr" info) = ccall reallyLockClosure(closure "ptr"); \
@@ -74,7 +76,7 @@ EXTERN_INLINE StgInfoTable *reallyLockClosure(StgClosure *p)
INLINE_HEADER StgInfoTable *lockClosure(StgClosure *p)
{
- if (n_capabilities == 1) {
+ if (getNumCapabilities() == 1) {
return (StgInfoTable *)p->header.info;
}
else {
@@ -87,7 +89,7 @@ INLINE_HEADER StgInfoTable *lockClosure(StgClosure *p)
EXTERN_INLINE StgInfoTable *tryLockClosure(StgClosure *p)
{
StgWord info;
- if (n_capabilities == 1) {
+ if (RELAXED_LOAD(&n_capabilities) == 1) {
return (StgInfoTable *)p->header.info;
}
else {