Module Async
This module is undocumented. This is a list of its definitions.
pmap :: (a -> <Proc> b) -> [a] -> <Proc> [b]
Like map, but applies the given function to the elements of the list in parallel.
- Threads: the function runs on the common fork-join pool's threads and on the caller's.
Which element runs on which thread is unspecified.
- Order: the result is in the list's order.
- Context: the function sees the caller's SCL context only when it happens to run on the
caller's thread. On a pool thread it sees that thread's own context, which may hold what
earlier functions run there put into it. The function must not rely on any context entry
(
graph and the reporting handler included), must not put entries into the context, and
must not write (syncWrite) while the caller holds a transaction.
- Statics: not for code with static state or output ordered by identity: the threads and
the identity hashes follow the JVM's history, so such output is not reproducible.
- Exceptions: an exception thrown for any element is rethrown to the caller with its type.
Thrown on the caller's thread, it is the function's own exception; thrown on a pool thread,
it is a new exception of the same type whose cause is the function's (the original itself
when the type cannot be constructed so). The other elements may still run.
runAsync :: <Proc> a -> <Proc> ()
Executes the given expression in a background thread and returns immediately.
The thread gets a derived copy of the current SCL context. An exception thrown
by the expression is logged, not propagated to the caller.
schedule :: <Proc> a -> Long -> TimeUnit -> <Proc> Future a
schedule f delay unit executes f once after the given delay.
scheduleAtFixedRate :: <Proc> a -> Long -> Long -> TimeUnit -> <Proc> Future a
scheduleAtFixedRate f initialDelay period unit starts executing f
periodically after initialDelay, aiming at a constant rate of one execution
per period. Both times are given in the given time unit.
scheduleWithFixedDelay :: <Proc> a -> Long -> Long -> TimeUnit -> <Proc> Future a
scheduleWithFixedDelay f initialDelay period unit starts executing f
periodically after initialDelay, leaving period of idle time between the
end of one execution and the beginning of the next. Both times are given in
the given time unit.
|