Compare-and-swap semantics in GHC

KwangYul Seo kwangyul.seo at gmail.com
Thu Dec 5 07:58:50 UTC 2013


Hi,

java.util.concurrent.atomic package provides two flavors of compare and set
operations: compareAndSet and weakCompareAndSet. The latter does not create
any happens-before orderings, so we can use it where no guarantees with
respect to previous or subsequent reads and writes of any variables other
than the target of the weakCompareAndSet are required.

I'd like to ask if the compare-and-swap function provided by GHC runtime
(cas() in includes/stg/SMP.h) is strong or weak. If it is strong, do all
use cases of cas() require this semantics?

Regards,
Kwang Yul Seo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/ghc-devs/attachments/20131205/4dd16fec/attachment-0001.html>


More information about the ghc-devs mailing list