atomic-primops

A safe approach to CAS and other atomic ops in Haskell.

http://github.com/rrnewton/haskell-lockfree/wiki

Version on this page:0.8.3
LTS Haskell 23.23:0.8.8
Stackage Nightly 2025-05-25:0.8.8
Latest on Hackage:0.8.8

See all snapshots atomic-primops appears in

BSD-3-Clause licensed by Ryan Newton
Maintained by rrnewton@gmail.com
This version can be pinned in stack with:atomic-primops-0.8.3@sha256:e01558f9ee5301d0a377db41b899703d31b45afb8da37387d2f02817d46706bc,2339

Module documentation for 0.8.3

After GHC 7.4 a new casMutVar# primop became available, but it's difficult to use safely, because pointer equality is a highly unstable property in Haskell. This library provides a safer method based on the concept of Tickets.

Also, this library uses the "foreign primop" capability of GHC to add access to other variants that may be of interest, specifically, compare and swap inside an array.

Note that as of GHC 7.8, the relevant primops have been included in GHC itself. This library is engineered to work pre- and post-GHC-7.8, while exposing the same interface.

Changes