1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

add scm_dynwind_lock_port

* libguile/ports.h:
* libguile/ports.c (scm_dynwind_lock_port): New function.
This commit is contained in:
Andy Wingo 2011-11-08 19:16:33 +01:00
parent f209aeee9f
commit 14dcb5ccd2
2 changed files with 27 additions and 0 deletions

View file

@ -1096,6 +1096,32 @@ SCM_DEFINE (scm_set_port_conversion_strategy_x, "set-port-conversion-strategy!",
#undef FUNC_NAME
/* The port lock. */
static void
lock_port (SCM port)
{
scm_c_lock_port (port);
}
static void
unlock_port (SCM port)
{
scm_c_unlock_port (port);
}
void
scm_dynwind_lock_port (SCM port)
{
scm_dynwind_unwind_handler_with_scm (unlock_port, port,
SCM_F_WIND_EXPLICITLY);
scm_dynwind_rewind_handler_with_scm (lock_port, port,
SCM_F_WIND_EXPLICITLY);
}
/* Revealed counts --- an oddity inherited from SCSH. */

View file

@ -294,6 +294,7 @@ SCM_API SCM scm_port_conversion_strategy (SCM port);
SCM_API SCM scm_set_port_conversion_strategy_x (SCM port, SCM behavior);
/* Acquiring and releasing the port lock. */
SCM_API void scm_dynwind_lock_port (SCM port);
SCM_INLINE int scm_c_lock_port (SCM port);
SCM_INLINE int scm_c_try_lock_port (SCM port);
SCM_INLINE int scm_c_unlock_port (SCM port);