Skip to content
Snippets Groups Projects
Commit 5f7079b9 authored by Simon Marlow's avatar Simon Marlow
Browse files

add a single-threaded version of cas()

parent aee6d689
No related merge requests found
...@@ -218,6 +218,17 @@ xchg(StgPtr p, StgWord w) ...@@ -218,6 +218,17 @@ xchg(StgPtr p, StgWord w)
return old; 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 /* !THREADED_RTS */
#endif /* SMP_H */ #endif /* SMP_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment