Warning: This is the manual of the legacy Guile 2.0 series. You may want to read the manual of the current stable series instead.

Next: , Up: Asyncs   [Contents][Index]


6.21.2.1 System asyncs

To cause the future asynchronous execution of a procedure in a given thread, use system-async-mark.

Automatic invocation of system asyncs can be temporarily disabled by calling call-with-blocked-asyncs. This function works by temporarily increasing the async blocking level of the current thread while a given procedure is running. The blocking level starts out at zero, and whenever a safe point is reached, a blocking level greater than zero will prevent the execution of queued asyncs.

Analogously, the procedure call-with-unblocked-asyncs will temporarily decrease the blocking level of the current thread. You can use it when you want to disable asyncs by default and only allow them temporarily.

In addition to the C versions of call-with-blocked-asyncs and call-with-unblocked-asyncs, C code can use scm_dynwind_block_asyncs and scm_dynwind_unblock_asyncs inside a dynamic context (see Dynamic Wind) to block or unblock system asyncs temporarily.

Scheme Procedure: system-async-mark proc [thread]
C Function: scm_system_async_mark (proc)
C Function: scm_system_async_mark_for_thread (proc, thread)

Mark proc (a procedure with zero arguments) for future execution in thread. When proc has already been marked for thread but has not been executed yet, this call has no effect. When thread is omitted, the thread that called system-async-mark is used.

This procedure is not safe to be called from signal handlers. Use scm_sigaction or scm_sigaction_for_thread to install signal handlers.

Scheme Procedure: call-with-blocked-asyncs proc
C Function: scm_call_with_blocked_asyncs (proc)

Call proc and block the execution of system asyncs by one level for the current thread while it is running. Return the value returned by proc. For the first two variants, call proc with no arguments; for the third, call it with data.

C Function: void * scm_c_call_with_blocked_asyncs (void * (*proc) (void *data), void *data)

The same but with a C function proc instead of a Scheme thunk.

Scheme Procedure: call-with-unblocked-asyncs proc
C Function: scm_call_with_unblocked_asyncs (proc)

Call proc and unblock the execution of system asyncs by one level for the current thread while it is running. Return the value returned by proc. For the first two variants, call proc with no arguments; for the third, call it with data.

C Function: void * scm_c_call_with_unblocked_asyncs (void *(*proc) (void *data), void *data)

The same but with a C function proc instead of a Scheme thunk.

C Function: void scm_dynwind_block_asyncs ()

During the current dynwind context, increase the blocking of asyncs by one level. This function must be used inside a pair of calls to scm_dynwind_begin and scm_dynwind_end (see Dynamic Wind).

C Function: void scm_dynwind_unblock_asyncs ()

During the current dynwind context, decrease the blocking of asyncs by one level. This function must be used inside a pair of calls to scm_dynwind_begin and scm_dynwind_end (see Dynamic Wind).


Next: , Up: Asyncs   [Contents][Index]