Next: Dynamic Roots, Previous: Arbiters, Up: Scheduling
An async is a pair of one thunk (a parameterless procedure) and a mark. Setting the mark on an async guarantees that the thunk will be executed somewhen in the future (asynchronously). Setting the mark more than once is satisfied by one execution of the thunk.
Guile supports two types of asyncs: Normal asyncs and system asyncs. They differ in that marked system asyncs are executed implicitly as soon as possible, whereas normal asyncs have to be invoked explicitly. System asyncs are held in an internal data structure and are maintained by Guile.
Normal asyncs are created with async, system asyncs with
system-async. They are marked with async-mark or
system-async-mark, respectively.
Create a new async for the procedure thunk.
Create a new async for the procedure thunk. Also, add it to the system's list of active async objects.
Mark the async a for future execution.
Mark the async a for future execution.
As already mentioned above, system asyncs are executed automatically.
Normal asyncs have to be explicitly invoked by storing one or more of
them into a list and passing them to run-asyncs.
Execute all thunks from the asyncs in the list.
Automatic invocation of system asyncs can be temporarily disabled by
calling mask-signals and unmask-signals. Setting the mark
while async execution is disabled will nevertheless cause the async to
run once execution is enabled again. Please note that calls to these
procedures should always be paired, and they must not be nested, e.g. no
mask-signals is allowed if another one is still active.