Warning: This is the manual of the legacy Guile 2.2 series. You may want to read the manual of the current stable series instead.
Next: Futures, Previous: Mutexes and Condition Variables, Up: Scheduling [Contents][Index]
Up to Guile version 1.8, a thread blocked in guile mode would prevent
the garbage collector from running. Thus threads had to explicitly
leave guile mode with scm_without_guile ()
before making a
potentially blocking call such as a mutex lock, a select ()
system call, etc. The following functions could be used to temporarily
leave guile mode or to perform some common blocking operations in a
supported way.
Starting from Guile 2.0, blocked threads no longer hinder garbage collection. Thus, the functions below are not needed anymore. They can still be used to inform the GC that a thread is about to block, giving it a (small) optimization opportunity for “stop the world” garbage collections, should they occur while the thread is blocked.
Leave guile mode, call func on data, enter guile mode and return the result of calling func.
While a thread has left guile mode, it must not call any libguile
functions except scm_with_guile
or scm_without_guile
and
must not use any libguile macros. Also, local variables of type
SCM
that are allocated while not in guile mode are not
protected from the garbage collector.
When used from non-guile mode, calling scm_without_guile
is
still allowed: it simply calls func. In that way, you can leave
guile mode without having to know whether the current thread is in
guile mode or not.
Like pthread_mutex_lock
, but leaves guile mode while waiting for
the mutex.
Like pthread_cond_wait
and pthread_cond_timedwait
, but
leaves guile mode while waiting for the condition variable.
Like select
but leaves guile mode while waiting. Also, the
delivery of an async causes this function to be interrupted with error
code EINTR
.
Like sleep
, but leaves guile mode while sleeping. Also, the
delivery of an async causes this function to be interrupted.
Like usleep
, but leaves guile mode while sleeping. Also, the
delivery of an async causes this function to be interrupted.
Next: Futures, Previous: Mutexes and Condition Variables, Up: Scheduling [Contents][Index]