[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-290-g8
From: |
Andy Wingo |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-11-290-g877514d |
Date: |
Sat, 28 Aug 2010 19:13:33 +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=877514dab09db6b012e68a17301315586e8f27b6
The branch, master has been updated
via 877514dab09db6b012e68a17301315586e8f27b6 (commit)
via fb61f4b8269b269e86e12ac2f9ead1faeb350436 (commit)
via f5e854388b4d96cbfa65b95a689c50e5e2d1a2b6 (commit)
from 35b6730879bd63a46270abce833a912624f2b2e3 (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 877514dab09db6b012e68a17301315586e8f27b6
Author: Andy Wingo <address@hidden>
Date: Sat Aug 28 12:15:53 2010 -0700
threadsafety in deprecation, extensions
* libguile/deprecation.c (scm_c_issue_deprecation_warning):
* libguile/extensions.c (scm_c_register_extension, load_extension): Add
locks around global data structures.
commit fb61f4b8269b269e86e12ac2f9ead1faeb350436
Author: Andy Wingo <address@hidden>
Date: Sat Aug 28 12:02:12 2010 -0700
net-db.test tweak
* test-suite/tests/net-db.test: Throw 'unresolved if we have a crap DNS
that is returning results for all addresses.
commit f5e854388b4d96cbfa65b95a689c50e5e2d1a2b6
Author: Andy Wingo <address@hidden>
Date: Sat Aug 28 11:57:51 2010 -0700
threadsafe object properties
* libguile/objprop.c: Add locking around the properties weak hash, to
avoid corrupting the whash.
-----------------------------------------------------------------------
Summary of changes:
libguile/deprecation.c | 12 +++++++++---
libguile/extensions.c | 15 ++++++++++++---
libguile/objprop.c | 24 +++++++++++++++++++-----
test-suite/tests/net-db.test | 5 +++--
4 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/libguile/deprecation.c b/libguile/deprecation.c
index af8b936..d3f0fd0 100644
--- a/libguile/deprecation.c
+++ b/libguile/deprecation.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -47,6 +47,7 @@ struct issued_warning {
const char *message;
};
+static scm_i_pthread_mutex_t warn_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
static struct issued_warning *issued_warnings;
static int print_summary = 0;
@@ -58,9 +59,11 @@ scm_c_issue_deprecation_warning (const char *msg)
else
{
struct issued_warning *iw;
+
+ scm_i_pthread_mutex_lock (&warn_lock);
for (iw = issued_warnings; iw; iw = iw->prev)
if (!strcmp (iw->message, msg))
- return;
+ goto done;
if (scm_gc_running_p)
fprintf (stderr, "%s\n", msg);
else
@@ -71,10 +74,13 @@ scm_c_issue_deprecation_warning (const char *msg)
msg = strdup (msg);
iw = malloc (sizeof (struct issued_warning));
if (msg == NULL || iw == NULL)
- return;
+ goto done;
iw->message = msg;
iw->prev = issued_warnings;
issued_warnings = iw;
+
+ done:
+ scm_i_pthread_mutex_unlock (&warn_lock);
}
}
diff --git a/libguile/extensions.c b/libguile/extensions.c
index d01e9c6..d830acb 100644
--- a/libguile/extensions.c
+++ b/libguile/extensions.c
@@ -1,6 +1,6 @@
/* extensions.c - registering and loading extensions.
*
- * Copyright (C) 2001, 2006, 2009 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2006, 2009, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -42,6 +42,7 @@ typedef struct extension_t
} extension_t;
static extension_t *registered_extensions = NULL;
+static scm_i_pthread_mutex_t ext_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
/* Register a LIB/INIT pair for use by `scm_load_extension'. LIB is
allowed to be NULL and then only INIT is used to identify the
@@ -65,15 +66,23 @@ scm_c_register_extension (const char *lib, const char *init,
ext->func = func;
ext->data = data;
+ scm_i_pthread_mutex_lock (&ext_lock);
ext->next = registered_extensions;
registered_extensions = ext;
+ scm_i_pthread_mutex_unlock (&ext_lock);
}
static void
load_extension (SCM lib, SCM init)
{
+ extension_t *head;
+
+ scm_i_pthread_mutex_lock (&ext_lock);
+ head = registered_extensions;
+ scm_i_pthread_mutex_unlock (&ext_lock);
+
/* Search the registry. */
- if (registered_extensions != NULL)
+ if (head != NULL)
{
extension_t *ext;
char *clib, *cinit;
@@ -86,7 +95,7 @@ load_extension (SCM lib, SCM init)
cinit = scm_to_locale_string (init);
scm_dynwind_free (cinit);
- for (ext = registered_extensions; ext; ext = ext->next)
+ for (ext = head; ext; ext = ext->next)
if ((ext->lib == NULL || !strcmp (ext->lib, clib))
&& !strcmp (ext->init, cinit))
{
diff --git a/libguile/objprop.c b/libguile/objprop.c
index 39fcfb5..dfa8494 100644
--- a/libguile/objprop.c
+++ b/libguile/objprop.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996, 2000, 2001, 2003, 2006, 2008, 2009 Free
Software Foundation, Inc.
+/* Copyright (C) 1995,1996, 2000, 2001, 2003, 2006, 2008, 2009, 2010 Free
Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -36,13 +36,20 @@
*/
static SCM object_whash;
+static scm_i_pthread_mutex_t whash_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
SCM_DEFINE (scm_object_properties, "object-properties", 1, 0, 0,
(SCM obj),
"Return @var{obj}'s property list.")
#define FUNC_NAME s_scm_object_properties
{
- return scm_hashq_ref (object_whash, obj, SCM_EOL);
+ SCM ret;
+
+ scm_i_pthread_mutex_lock (&whash_mutex);
+ ret = scm_hashq_ref (object_whash, obj, SCM_EOL);
+ scm_i_pthread_mutex_unlock (&whash_mutex);
+
+ return ret;
}
#undef FUNC_NAME
@@ -52,8 +59,13 @@ SCM_DEFINE (scm_set_object_properties_x,
"set-object-properties!", 2, 0, 0,
"Set @var{obj}'s property list to @var{alist}.")
#define FUNC_NAME s_scm_set_object_properties_x
{
- SCM handle = scm_hashq_create_handle_x (object_whash, obj, alist);
+ SCM handle;
+
+ scm_i_pthread_mutex_lock (&whash_mutex);
+ handle = scm_hashq_create_handle_x (object_whash, obj, alist);
SCM_SETCDR (handle, alist);
+ scm_i_pthread_mutex_unlock (&whash_mutex);
+
return alist;
}
#undef FUNC_NAME
@@ -77,8 +89,9 @@ SCM_DEFINE (scm_set_object_property_x,
"set-object-property!", 3, 0, 0,
{
SCM h;
SCM assoc;
+
+ scm_i_pthread_mutex_lock (&whash_mutex);
h = scm_hashq_create_handle_x (object_whash, obj, SCM_EOL);
- SCM_CRITICAL_SECTION_START;
assoc = scm_assq (key, SCM_CDR (h));
if (SCM_NIMP (assoc))
SCM_SETCDR (assoc, value);
@@ -87,7 +100,8 @@ SCM_DEFINE (scm_set_object_property_x,
"set-object-property!", 3, 0, 0,
assoc = scm_acons (key, value, SCM_CDR (h));
SCM_SETCDR (h, assoc);
}
- SCM_CRITICAL_SECTION_END;
+ scm_i_pthread_mutex_unlock (&whash_mutex);
+
return value;
}
#undef FUNC_NAME
diff --git a/test-suite/tests/net-db.test b/test-suite/tests/net-db.test
index 47d12a9..083cf5f 100644
--- a/test-suite/tests/net-db.test
+++ b/test-suite/tests/net-db.test
@@ -68,8 +68,9 @@
(pass-if "no name"
(catch 'getaddrinfo-error
(lambda ()
- (getaddrinfo "does-not-exist")
- #f)
+ (pk "getaddrinfo for \"does-not-exist\" succeeded!"
+ (getaddrinfo "does-not-exist"))
+ (throw 'unresolved))
(lambda (key errcode)
;; In some cases (e.g., in a chroot without
;; /etc/{hosts,resolv.conf}), this can result in `EAI_EAGAIN'.
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-11-290-g877514d,
Andy Wingo <=