1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 23:00:22 +02:00

Removed scm_leave_guile, scm_enter_guile and all references to

them since they are no longer in the API.
This commit is contained in:
Marius Vollmer 2005-12-06 20:27:59 +00:00
parent b54df25486
commit 54428bb84e
3 changed files with 26 additions and 37 deletions

View file

@ -13,9 +13,9 @@ put itself into guile mode with either @code{scm_with_guile} or
@code{scm_init_guile}. The global state of Guile is initialized @code{scm_init_guile}. The global state of Guile is initialized
automatically when the first thread enters guile mode. automatically when the first thread enters guile mode.
When a thread wants to block outside of a Guile API function, it should When a thread wants to block outside of a Guile API function, it
leave guile mode temporarily with either @code{scm_without_guile} or should leave guile mode temporarily with @code{scm_without_guile},
@code{scm_leave_guile}, @xref{Blocking}. @xref{Blocking}.
Threads that are created by @code{call-with-new-thread} or Threads that are created by @code{call-with-new-thread} or
@code{scm_spawn_thread} start out in guile mode so you don't need to @code{scm_spawn_thread} start out in guile mode so you don't need to
@ -51,8 +51,8 @@ See @code{scm_init_guile} for another approach at initializing Guile
that does not have this restriction. that does not have this restriction.
It is OK to call @code{scm_with_guile} while a thread has temporarily It is OK to call @code{scm_with_guile} while a thread has temporarily
left guile mode via @code{scm_without_guile} or @code{scm_leave_guile}. left guile mode via @code{scm_without_guile}. It will then simply
It will then simply temporarily enter guile mode again. temporarily enter guile mode again.
@end deftypefn @end deftypefn
@deftypefn {C Function} void scm_init_guile () @deftypefn {C Function} void scm_init_guile ()

View file

@ -452,30 +452,20 @@ guile mode. The following functions can be used to temporily leave
guile mode or to perform some common blocking operations in a supported guile mode or to perform some common blocking operations in a supported
way. way.
@deftypefn {C Function} scm_t_guile_ticket scm_leave_guile () @deftypefn {C Function} {void *} scm_without_guile (void *(*func) (void *), void *data)
@deftypefnx {C Function} void scm_enter_guile (scm_t_guile_ticket ticket) Leave guile mode, call @var{func} on @var{data}, enter guile mode and
These two functions must be called as a pair and can be used to leave return the result of calling @var{func}.
guile mode temporarily. The call to @code{scm_leave_guile} returns a
ticket that must be used with @code{scm_enter_guile} to match up the two
calls.
While a thread has left guile mode, it must not call any libguile While a thread has left guile mode, it must not call any libguile
functions except @code{scm_enter_guile}, @code{scm_with_guile}, functions except @code{scm_with_guile} or @code{scm_without_guile} and
@code{scm_without_guile} or @code{scm_leave_guile} and must not use any must not use any libguile macros. Also, local variables of type
libguile macros. Also, local variables of type @code{SCM} that are @code{SCM} that are allocated while not in guile mode are not
allocated while not in guile mode are not protected from the garbage protected from the garbage collector.
collector.
When used from non-guile mode, a pair of calls to @code{scm_leave_guile} When used from non-guile mode, calling @code{scm_without_guile} is
and @code{scm_enter_guile} do nothing. In that way, you can leave guile still allowed: it simply calls @var{func}. In that way, you can leave
mode without having to know whether the current thread is in guile mode guile mode without having to know whether the current thread is in
or not. guile mode or not.
@end deftypefn
@deftypefn {C Function} {void *} scm_without_guile (void *(*func) (void *), void *data)
Leave guile mode as with @code{scm_leave_guile}, call @var{func} on
@var{data}, enter guile mode as with @code{scm_enter_guile} and return
the result of calling @var{func}.
@end deftypefn @end deftypefn
@deftypefn {C Function} int scm_pthread_mutex_lock (pthread_mutex_t *mutex) @deftypefn {C Function} int scm_pthread_mutex_lock (pthread_mutex_t *mutex)

View file

@ -451,17 +451,16 @@ that are stored in local variables. When a thread puts itself into
guile mode for the first time, it gets a Scheme representation and is guile mode for the first time, it gets a Scheme representation and is
listed by @code{all-threads}, for example. listed by @code{all-threads}, for example.
While in guile mode, a thread promises to reach a safe point reasonably While in guile mode, a thread promises to reach a safe point
frequently (@pxref{Asynchronous Signals}). In addition to running reasonably frequently (@pxref{Asynchronous Signals}). In addition to
signal handlers, these points are also potential rendezvous points of running signal handlers, these points are also potential rendezvous
all guile mode threads where Guile can orchestrate global things like points of all guile mode threads where Guile can orchestrate global
garbage collection. Consequently, when a thread in guile mode blocks things like garbage collection. Consequently, when a thread in guile
and does no longer frequent safe points, it might cause all other guile mode blocks and does no longer frequent safe points, it might cause
mode threads to block as well. To prevent this from happening, a guile all other guile mode threads to block as well. To prevent this from
mode thread should either only block in libguile functions (who know how happening, a guile mode thread should either only block in libguile
to do it right), or should temporarily leave guile mode with functions (who know how to do it right), or should temporarily leave
@code{scm_without_guile} or guile mode with @code{scm_without_guile}.
@code{scm_leave_guile}/@code{scm_enter_guile}.
For some common blocking operations, Guile provides convenience For some common blocking operations, Guile provides convenience
functions. For example, if you want to lock a pthread mutex while in functions. For example, if you want to lock a pthread mutex while in