Support for concurrency.
Concurrency in Frege comes in 2 flavors. The first is through Threads, which are, unlike in Haskell, OS threads.
The second possibility is to use a thread pool and an executor service one can submit tasks to. But note that blocking asynchronous tasks, unlike Haskell green threads, will block an OS thread on blocking actions.
A thread safe, shared variable, that is either full or empty.
Technically, this is just a BlockingQueue restricted to length 1.
create a MVar filled with a value
create an empty MVar
put a value in a MVar, returns false if already full.
get the value from a MVar, return Maybe.Nothing when empty
put a value in a MVar, blocks if full
take a value from a MVar, blocks if empty
Alias for MVar.newEmpty
Alias for MVar.new
Alias for MVar.take
Alias for MVar.put
Alias for MVar.poll
Alias for MVar.offer
Run the IO action asynchronously in an ExecutorService
This is not suitable for not-ending processes!
The executor service may manage a fixed small number of concurrent threads only.
Shutdwon the ExecutorService
Run a IO action asynchronously and return the result in a MVar