guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. v2.1.0-524-g79657fd


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, master, updated. v2.1.0-524-g79657fd
Date: Sun, 01 Dec 2013 23:35:35 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=79657fd3ec264ecd533a62d349c2cf1a2be2df14

The branch, master has been updated
       via  79657fd3ec264ecd533a62d349c2cf1a2be2df14 (commit)
      from  1f6f591d666a0332317374f32339cd4ec3e248e9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 79657fd3ec264ecd533a62d349c2cf1a2be2df14
Author: Mark H Weaver <address@hidden>
Date:   Sun Dec 1 18:29:33 2013 -0500

    Thread safe port properties.
    
    * libguile/ports.c (scm_i_port_property, scm_i_set_port_property_x):
      Lock the port mutex while accessing the port alist.
    
    * libguile/read.c (set_port_read_option): Lock the port mutex
      while modifying port read options.

-----------------------------------------------------------------------

Summary of changes:
 libguile/ports.c |   13 ++++++++++++-
 libguile/read.c  |    6 ++++++
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 61bd577..f4efce7 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -348,8 +348,15 @@ SCM_DEFINE (scm_i_port_property, "%port-property", 2, 0, 0,
             "Return the property of @var{port} associated with @var{key}.")
 #define FUNC_NAME s_scm_i_port_property
 {
+  scm_i_pthread_mutex_t *lock;
+  SCM result;
+
   SCM_VALIDATE_OPPORT (1, port);
-  return scm_assq_ref (SCM_PORT_GET_INTERNAL (port)->alist, key);
+  scm_c_lock_port (port, &lock);
+  result = scm_assq_ref (SCM_PORT_GET_INTERNAL (port)->alist, key);
+  if (lock)
+    scm_i_pthread_mutex_unlock (lock);
+  return result;
 }
 #undef FUNC_NAME
 
@@ -358,11 +365,15 @@ SCM_DEFINE (scm_i_set_port_property_x, 
"%set-port-property!", 3, 0, 0,
             "Set the property of @var{port} associated with @var{key} to 
@var{value}.")
 #define FUNC_NAME s_scm_i_set_port_property_x
 {
+  scm_i_pthread_mutex_t *lock;
   scm_t_port_internal *pti;
 
   SCM_VALIDATE_OPPORT (1, port);
+  scm_c_lock_port (port, &lock);
   pti = SCM_PORT_GET_INTERNAL (port);
   pti->alist = scm_assq_set_x (pti->alist, key, value);
+  if (lock)
+    scm_i_pthread_mutex_unlock (lock);
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME
diff --git a/libguile/read.c b/libguile/read.c
index d1e1be3..382a1d3 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -2157,6 +2157,10 @@ set_port_read_option (SCM port, int option, int 
new_value)
   unsigned int read_options;
 
   new_value &= READ_OPTION_MASK;
+
+  scm_dynwind_begin (0);
+  scm_dynwind_lock_port (port);
+
   scm_read_options = scm_i_port_property (port, sym_port_read_options);
   if (scm_is_unsigned_integer (scm_read_options, 0, READ_OPTIONS_MAX_VALUE))
     read_options = scm_to_uint (scm_read_options);
@@ -2166,6 +2170,8 @@ set_port_read_option (SCM port, int option, int new_value)
   read_options |= new_value << option;
   scm_read_options = scm_from_uint (read_options);
   scm_i_set_port_property_x (port, sym_port_read_options, scm_read_options);
+
+  scm_dynwind_end ();
 }
 
 /* Set OPTS and PORT's case-insensitivity according to VALUE. */


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]