summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2012-02-08 19:57:41 +0100
committerAndy Wingo <wingo@pobox.com>2012-02-17 12:11:14 +0100
commit6a97b1f93aace5c7c976aef51d36b3ae9cfd5630 (patch)
treed62914e464bb680663453931973aef3cb4e187b5
parent2f745b64a1eb06e9e175a1b497d5270bebff9097 (diff)
downloadguile-6a97b1f93aace5c7c976aef51d36b3ae9cfd5630.tar.gz
install pthread_atfork handlers for guile's static mutexen
* libguile/async.c: * libguile/deprecation.c: * libguile/fluids.c: * libguile/gc.c: * libguile/instructions.c: * libguile/ports.c: * libguile/posix.c: * libguile/strings.c: * libguile/threads.c: Use the SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX mechanism to lock a number of static mutexen.
-rw-r--r--libguile/async.c3
-rw-r--r--libguile/deprecation.c3
-rw-r--r--libguile/fluids.c1
-rw-r--r--libguile/gc.c3
-rw-r--r--libguile/instructions.c3
-rw-r--r--libguile/ports.c1
-rw-r--r--libguile/posix.c3
-rw-r--r--libguile/strings.c1
-rw-r--r--libguile/threads.c3
9 files changed, 16 insertions, 5 deletions
diff --git a/libguile/async.c b/libguile/async.c
index 80f561d10..e8739979c 100644
--- a/libguile/async.c
+++ b/libguile/async.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2002, 2004, 2006, 2008, 2009, 2010, 2011, 2012 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
@@ -133,6 +133,7 @@ SCM_DEFINE (scm_run_asyncs, "run-asyncs", 1, 0, 0,
static scm_i_pthread_mutex_t async_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (async_mutex);
/* System asyncs. */
diff --git a/libguile/deprecation.c b/libguile/deprecation.c
index 5c1a246c2..cb5377a19 100644
--- a/libguile/deprecation.c
+++ b/libguile/deprecation.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2006, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2006, 2010, 2011, 2012 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
@@ -48,6 +48,7 @@ struct issued_warning {
};
static scm_i_pthread_mutex_t warn_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (warn_lock);
static struct issued_warning *issued_warnings;
static int print_summary = 0;
diff --git a/libguile/fluids.c b/libguile/fluids.c
index 282718e65..e4906a418 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -44,6 +44,7 @@ static void **allocated_fluids = NULL;
static size_t allocated_fluids_len = 0;
static scm_i_pthread_mutex_t fluid_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (fluid_admin_mutex);
#define IS_FLUID(x) SCM_FLUID_P (x)
#define FLUID_NUM(x) SCM_I_FLUID_NUM (x)
diff --git a/libguile/gc.c b/libguile/gc.c
index 6d44f5e38..2c026b7fd 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2006, 2008, 2009, 2010, 2011, 2012 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
@@ -647,6 +647,7 @@ scm_storage_prehistory ()
}
scm_i_pthread_mutex_t scm_i_gc_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_i_gc_admin_mutex);
void
scm_init_gc_protect_object ()
diff --git a/libguile/instructions.c b/libguile/instructions.c
index f3b8963d2..2646f9029 100644
--- a/libguile/instructions.c
+++ b/libguile/instructions.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010, 2011, 2012 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
@@ -48,6 +48,7 @@ struct scm_instruction {
static scm_i_pthread_mutex_t itable_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (itable_lock);
static struct scm_instruction*
diff --git a/libguile/ports.c b/libguile/ports.c
index d3fc4532f..18607514c 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -103,6 +103,7 @@ static long scm_numptob = 0; /* Number of port types. */
static long scm_ptobs_size = 0; /* Number of slots in the port type
table. */
static scm_i_pthread_mutex_t scm_ptobs_lock = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_ptobs_lock);
long
scm_c_num_port_types (void)
diff --git a/libguile/posix.c b/libguile/posix.c
index 154d26ad9..f4d93f092 100644
--- a/libguile/posix.c
+++ b/libguile/posix.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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
@@ -1493,6 +1493,7 @@ SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
is also acquired before calls to `nl_langinfo ()'. See `i18n.c' for
details. */
scm_i_pthread_mutex_t scm_i_locale_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_i_locale_mutex);
#ifdef HAVE_SETLOCALE
diff --git a/libguile/strings.c b/libguile/strings.c
index 961705782..c2edcd70a 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -226,6 +226,7 @@ narrow_stringbuf (SCM buf)
}
scm_i_pthread_mutex_t stringbuf_write_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (stringbuf_write_mutex);
/* Copy-on-write strings.
diff --git a/libguile/threads.c b/libguile/threads.c
index d5c51eaf3..f78889b40 100644
--- a/libguile/threads.c
+++ b/libguile/threads.c
@@ -500,6 +500,7 @@ SCM_THREAD_LOCAL scm_i_thread *scm_i_current_thread = NULL;
static scm_i_pthread_mutex_t thread_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (thread_admin_mutex);
static scm_i_thread *all_threads = NULL;
static int thread_count;
@@ -2134,6 +2135,7 @@ static int threads_initialized_p = 0;
/* This mutex is used by SCM_CRITICAL_SECTION_START/END.
*/
scm_i_pthread_mutex_t scm_i_critical_section_mutex;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_i_critical_section_mutex);
static SCM dynwind_critical_section_mutex;
@@ -2149,6 +2151,7 @@ scm_dynwind_critical_section (SCM mutex)
/*** Initialization */
scm_i_pthread_mutex_t scm_i_misc_mutex;
+SCM_PTHREAD_ATFORK_LOCK_STATIC_MUTEX (scm_i_misc_mutex);
#if SCM_USE_PTHREAD_THREADS
pthread_mutexattr_t scm_i_pthread_mutexattr_recursive[1];