setThreadData : HasIO io => a -> io ()
Set the data stored in a thread's parameter to the given value.
Currently only supported under the scheme backends.
Totality: total
Visibility: exportgetThreadData : HasIO io => (a : Type) -> io a
Get the data stored in a thread's parameter.
Currently only supported under the scheme backends.
Totality: total
Visibility: exportdata Mutex : Type
- Totality: total
Visibility: export makeMutex : HasIO io => io Mutex
Creates and returns a new mutex.
Totality: total
Visibility: exportmutexAcquire : HasIO io => Mutex -> io ()
Acquires the mutex identified by `mutex`. The thread blocks until the mutex
has been acquired.
Mutexes are recursive in Posix threads terminology, which means that the
calling thread can use mutex-acquire to (re)acquire a mutex it already has.
In this case, an equal number of mutex-release calls is necessary to release
the mutex.
Totality: total
Visibility: exportmutexRelease : HasIO io => Mutex -> io ()
Releases the mutex identified by `mutex`. Unpredictable behavior results if
the mutex is not owned by the calling thread.
Totality: total
Visibility: exportdata Condition : Type
- Totality: total
Visibility: export makeCondition : HasIO io => io Condition
Creates and returns a new condition variable.
Totality: total
Visibility: exportconditionWait : HasIO io => Condition -> Mutex -> io ()
Waits up to the specified timeout for the condition identified by the
condition variable `cond`. The calling thread must have acquired the mutex
identified by `mutex` at the time `conditionWait` is called. The mutex is
released as a side effect of the call to `conditionWait`. When a thread is
later released from the condition variable by one of the procedures
described below, the mutex is reacquired and `conditionWait` returns.
Totality: total
Visibility: exportconditionWaitTimeout : HasIO io => Condition -> Mutex -> Int -> io ()
Variant of `conditionWait` with a timeout in microseconds.
When the timeout expires, the thread is released, `mutex` is reacquired, and
`conditionWaitTimeout` returns.
Totality: total
Visibility: exportconditionSignal : HasIO io => Condition -> io ()
Releases one of the threads waiting for the condition identified by `cond`.
Totality: total
Visibility: exportconditionBroadcast : HasIO io => Condition -> io ()
Releases all of the threads waiting for the condition identified by `cond`.
Totality: total
Visibility: exportdata Semaphore : Type
- Totality: total
Visibility: export makeSemaphore : HasIO io => Int -> io Semaphore
Creates and returns a new semaphore with the counter initially set to `init`.
Totality: total
Visibility: exportsemaphorePost : HasIO io => Semaphore -> io ()
Increments the semaphore's internal counter.
Totality: total
Visibility: exportsemaphoreWait : HasIO io => Semaphore -> io ()
Blocks until the internal counter for semaphore sema is non-zero. When the
counter is non-zero, it is decremented and `semaphoreWait` returns.
Totality: total
Visibility: exportdata Barrier : Type
A barrier enables multiple threads to synchronize the beginning of some
computation.
Totality: total
Visibility: exportmakeBarrier : HasIO io => Int -> io Barrier
Creates a new barrier that can block a given number of threads.
@ numThreads the number of threads to block
Totality: total
Visibility: exportbarrierWait : HasIO io => Barrier -> io ()
Blocks the current thread until all threads have rendezvoused here.
Totality: total
Visibility: exportdata Channel : Type -> Type
- Totality: total
Visibility: export makeChannel : HasIO io => io (Channel a)
Creates and returns a new `Channel`.
The channel can be used with `channelGet` to receive a value through the
channel.
The channel can be used with `channelPut` to send a value through the
channel.
Totality: total
Visibility: exportchannelGet : HasIO io => Channel a -> io a
Blocks until a sender is ready to provide a value through `chan`. The result
is the sent value.
@ chan the channel to receive on
Totality: total
Visibility: exportchannelPut : HasIO io => Channel a -> a -> io ()
Puts a value on the given channel.
@ chan the `Channel` to send the value over
@ val the value to send
Totality: total
Visibility: export