[Haskell-cafe] Re: Support for lock-free/wait-free programming?

Gregory Collins greg at gregorycollins.net
Sat Aug 28 21:22:57 EDT 2010

Gregory Collins <greg at gregorycollins.net> writes:

> Gabriel Wicke <wicke at wikidev.net> writes:
>> On Tue, 17 Aug 2010 01:09:41 -0400, Gregory Collins wrote:
>>> Hello all,
>>> Does GHC expose any primitives for things like atomic compare-and-swap?
>>> I can't seem to find anything in the docs. 
>> Hello Gregory,
>> I have recently published experimental and low-level FFI bindings to
>> GCC's atomic primitives including CAS as 'bits-extras' on Hackage [1].
>> Instances for Int and Word types are included.
>> This is likely lower-level than what you are after, but might still be
>> handy for experimentation.
> On OSX libgcc_s is only supplied as a dynamic library, which GHC doesn't
> seem to be able to link with. Any ideas would be appreciated.

It works with this patch:

Remove cc-options field from .cabal; the flags given don't work on OSX

diff --git a/bits-extras.cabal b/bits-extras.cabal
--- a/bits-extras.cabal
+++ b/bits-extras.cabal
@@ -42,8 +42,6 @@
     --CC-Options:       -O3 -fomit-frame-pointer -march=native -Wall
     -- Try link-time optimization (inlining) with gcc 4.5:
     -- CC-Options:       -fomit-frame-pointer -march=native -Wall -flto
-    CC-Options:       -fomit-frame-pointer -march=native -Wall
-    Extra-Libraries:  gcc_s
     Include-Dirs:     cbits
     Install-Includes: bitops-gcc.h atomic-bitops-gcc.h
     Extensions:       ForeignFunctionInterface

Gregory Collins <greg at gregorycollins.net>

More information about the Haskell-Cafe mailing list