summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-11-08 19:16:33 +0100
committerAndy Wingo <wingo@pobox.com>2011-11-08 19:16:33 +0100
commit14dcb5ccd282622abd71aed3e41235d90f89d39d (patch)
tree4fd5c8d3b9bb62105e453740804a7b7062f3141b
parentf209aeee9fc5032863cc07138be927da87d3a091 (diff)
downloadguile-14dcb5ccd282622abd71aed3e41235d90f89d39d.tar.gz
add scm_dynwind_lock_port
* libguile/ports.h: * libguile/ports.c (scm_dynwind_lock_port): New function.
-rw-r--r--libguile/ports.c26
-rw-r--r--libguile/ports.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/libguile/ports.c b/libguile/ports.c
index a95774b31..bad524e97 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1098,6 +1098,32 @@ SCM_DEFINE (scm_set_port_conversion_strategy_x, "set-port-conversion-strategy!",
+/* 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. */
/* Find a port in the table and return its revealed count.
diff --git a/libguile/ports.h b/libguile/ports.h
index 56cafdb35..624b7b860 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -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);