Node:Asyncs,
Next:Dynamic Roots,
Previous:Arbiters,
Up:Scheduling
32.2 Asyncs
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.
async thunk
|
Scheme Procedure |
scm_async (thunk)
|
C Function |
Create a new async for the procedure thunk.
|
system-async thunk
|
Scheme Procedure |
scm_system_async (thunk)
|
C Function |
Create a new async for the procedure thunk. Also
add it to the system's list of active async objects.
|
async-mark a
|
Scheme Procedure |
scm_async_mark (a)
|
C Function |
Mark the async a for future execution.
|
system-async-mark a
|
Scheme Procedure |
scm_system_async_mark (a)
|
C Function |
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
.
run-asyncs list_of_a
|
Scheme Procedure |
scm_run_asyncs (list_of_a)
|
C Function |
Execute all thunks from the asyncs of the list list_of_a.
|
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.
mask-signals
|
Scheme Procedure |
scm_mask_signals ()
|
C Function |
Mask signals. The returned value is not specified.
|
unmask-signals
|
Scheme Procedure |
scm_unmask_signals ()
|
C Function |
Unmask signals. The returned value is not specified.
|
noop . args
|
Scheme Procedure |
scm_noop (args)
|
C Function |
Do nothing. When called without arguments, return #f ,
otherwise return the first argument.
|