www.delorie.com/gnu/docs/guile/guile_367.html   search  
Buy GNU books!

Guile Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.

Scheme Procedure: async thunk
C Function: scm_async (thunk)
Create a new async for the procedure thunk.

Scheme Procedure: system-async thunk
C Function: scm_system_async (thunk)
Create a new async for the procedure thunk. Also add it to the system's list of active async objects.

Scheme Procedure: async-mark a
C Function: scm_async_mark (a)
Mark the async a for future execution.

Scheme Procedure: system-async-mark a
C Function: scm_system_async_mark (a)
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.

Scheme Procedure: run-asyncs list_of_a
C Function: scm_run_asyncs (list_of_a)
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.

Scheme Procedure: mask-signals
C Function: scm_mask_signals ()
Mask signals. The returned value is not specified.

Scheme Procedure: unmask-signals
C Function: scm_unmask_signals ()
Unmask signals. The returned value is not specified.

Scheme Procedure: noop . args
C Function: scm_noop (args)
Do nothing. When called without arguments, return #f, otherwise return the first argument.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003