srfi.226
- Control features ¶This srfi enhances the semantics of Scheme’s fundamental concepts
such as continuations and dynamic environments, to support multi-threaded
programs and delimited continuations. Some R7RS primitives such as
call/cc
and dynamic-wind
are extended
to be consistent with the enhanced execution model.
The thread API is mostly compatible with SRFI-18, and so as with
Gauche’s thread API (see gauche.threads
- Threads).
Since the enhanced features are tightly coupled with runtime, most APIs in this srfi is implemented as built-ins in Gauche. This section gives you the overview of SRFI-226 APIs and pointers to the documents.
In 0.9.13, Gauche only implements part of SRFI-226. We’ll cover its entirety in future releases.
SRFI-226 is an upward compatible extension of R7RS. However, Gauche has also
extended R7RS control features in regards of multi-threaded
programs, and there are subtle incompatibilites. We’ll move to
full SRFI-226 compatibility, but we also provide backward-compatible
interface. If you use srfi.226
, you’ll get SRFI-226
behavior.
Here’s a list of SRFI-226 APIs and how Gauche supports them.
&continuation
make-continuation-violation
continuation-violation?
continuation-violation-prompt-tag
See Conditions
make-continuation-prompt-tag
default-continuation-prompt-tag
continuation-prompt-tag?
call-with-continuation-prompt
abort-current-continuation
See Continuation prompts.
call-with-non-comosable-continuation
call-with-composable-continuation
Not implemented yet.
call-with-current-continuation
call/cc
See Continuations.
call-in-continuation
call-in
Not implemented yet.
call-with-continuation-barrier
Not implemented yet.
continuation-prompt-available?
Not implemented yet.
dynamic-wind
See Continuations.
unwind-protect
shift-at
reset-at
Not implemented yet.
shift
reset
See gauche.partcont
- Partial continuations. However, current implementation
of shift
/reset
hasn’t integrated to SRFI-226 model
yet.
continuation?
non-composable-continuation?
Not implemented yet.
with-continuation-mark
with-continuation-marks
call-with-immediate-continuation-mark
continuation-marks
current-continuation-marks
continuation-mark-set?
continuation-mark-set->list
continuation-mark-set-first
See Continuation marks.
continuation-mark-set->list*
continuation-mark-set->iterator
Not implemented yet.
make-continuation-mark-key
continuation-mark-key?
See Continuation marks.
make-parameter
make-thread-parameter
See Parameters. Gauche’s built-in make-parameter
works
in a compatibility mode for now. If you use srfi.226
,
make-parameter
works as specified in SRFI-226.
parameter?
See Parameters.
parameterize
See Parameters. Gauche’s built-in parameterize
works
in a compatibility mode for now. If you use srfi.226
,
make-parameter
works as specified in SRFI-226.
current-parameterization
parameterization?
call-with-parameterization
See Parameters.
temporarily
See Dynamic states.
define-fluid
define-thread-fluid
define-fluidified
fluid-let
fluid-let*
fluid-parameter
Not implemented yet.
call-with-initial-continuation
Not implemented yet.
delay
promise?
force
make-promise
See Delay, force and lazy. Gauche’s built-ins are SRFI-226 compatible.
with-exception-handler
current-exception-handler
exception-handler-stack
See Low-level exception handling mechanism. Gauche’s built-ins are SRFI-226 compatible.
raise
raise-continuable
See Signaling exceptions.
guard
¶meterization
make-parameterization-condition
parameterization-condition?
condition-parameterization
Not implemented yet.
&continuation-marks
make-continuation-marks-condition
continuation-marks-condition?
condition-continuation-marks
Not implemented yet.
&exception-handler-stack
make-exception-handler-stack-condition
exception-handler-stack-condition?
condition-exception-handler-stack
Not implemented yet.
time?
current-time
seconds+ time
See Time.
&thread
make-thread-condition
thread-condition?
&uncaught-exception
make-uncaught-exception
uncaught-exception-condition?
uncaught-exception-condition-reason
&thread-already-terminated
make-thread-already-terminated-condition
thread-already-terminated-condition?
&thread-timeout
make-thread-timeout-condition
thread-timeout-condition?
&thread-abandoned-mutex
make-thread-abandoned-mutex-condition
thread-abandoned-mutex-condition?
&concurrent-modification
make-concurrent-modification-violation
concurrent-modification-violation?
See Thread exceptions.
make-thread
thread?
current-thread
thread-start!
thread-yield!
thread-sleep!
thread-terminate!
thread-schedule-terminate!
thread-join!
make-mutex
mutex?
mutex-state
mutex-lock!
mutex-unlock!
See Mutex.
make-condition-variable
condition-variable?
condition-variable-signal!
condition-variable-broadcast!
See Condition variable.
make-thread-local
thread-local?
tlref
tlset!
See Thread local storage.
current-interrupt-level
disable-interrupts!
enable-interrupts!
with-interrupts-disabled
with-interrupts-enabled
thread-interrupt!
Not implemented yet.