@hackage concurrent-extra0.2

Extra concurrency primitives

The concurrent-extra package offers among other things the following selection of synchronisation primitives:

  • Lock: Enforce exclusive access to a resource. Also known as a binary semaphore or mutex.

  • RLock: A lock which can be acquired multiple times by the same thread. Also known as a reentrant mutex.

  • Broadcast: Wake multiple threads by broadcasting a value.

  • Event: Wake multiple threads by signalling an event.

  • ReadWriteLock: Multiple-reader, single-writer locks. Used to protect shared resources which may be concurrently read, but only sequentially written.

  • ReadWriteVar: Concurrent read, sequential write variables.

The package also provides STM versions of Broadcast and Event.

Besides these synchronisation primitives the package provides:

  • Thread: Threads extended with the ability to wait for their termination.

  • delay: Arbitrarily long thread delays.

  • timeout: Wait arbitrarily long for an IO computation to finish.

Please consult the API documentation of the individual modules for more detailed information.

This package was inspired by the concurrency libraries of Java and Python.