1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-03 05:20:16 +02:00

use scm_c_atfork_lock_static_mutex for guile's static mutexen

* libguile/async.c (scm_init_async):
* libguile/deprecation.c (scm_init_deprecation):
* libguile/fluids.c (scm_init_fluids):
* libguile/gc.c (scm_init_gc):
* libguile/instructions.c (scm_bootstrap_instructions):
* libguile/ports.c (scm_init_ports):
* libguile/posix.c (scm_init_posix):
* libguile/strings.c (string_get_handle):
* libguile/threads.c (scm_init_threads): Use the atfork mutex mechanism
  to lock a number of static mutexen.
This commit is contained in:
Andy Wingo 2012-02-08 19:57:41 +01:00
parent 585eb4f702
commit 7329a5dba1
9 changed files with 20 additions and 4 deletions

View file

@ -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
@ -451,6 +451,8 @@ scm_init_async ()
{
tc16_async = scm_make_smob_type ("async", 0);
scm_c_atfork_lock_static_mutex (&async_mutex);
#include "libguile/async.x"
}

View file

@ -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
@ -184,6 +184,7 @@ scm_init_deprecation ()
SCM_WARN_DEPRECATED = 0;
atexit (print_deprecation_summary);
}
scm_c_atfork_lock_static_mutex (&warn_lock);
#include "libguile/deprecation.x"
}

View file

@ -590,6 +590,7 @@ void
scm_init_fluids ()
{
#include "libguile/fluids.x"
scm_c_atfork_lock_static_mutex (&fluid_admin_mutex);
}
/*

View file

@ -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
@ -1046,6 +1046,8 @@ scm_init_gc ()
GC_set_start_callback (run_before_gc_c_hook);
#endif
scm_c_atfork_lock_static_mutex (&bytes_until_gc_lock);
#include "libguile/gc.x"
}

View file

@ -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
@ -208,6 +208,7 @@ scm_bootstrap_instructions (void)
"scm_init_instructions",
(scm_t_extension_init_func)scm_init_instructions,
NULL);
scm_c_atfork_lock_static_mutex (&itable_lock);
}
void

View file

@ -2906,6 +2906,7 @@ scm_init_ports ()
cur_loadport_fluid = scm_make_fluid ();
scm_i_port_weak_set = scm_c_make_weak_set (31);
scm_c_atfork_lock_static_mutex (&scm_ptobs_lock);
#include "libguile/ports.x"

View file

@ -2252,6 +2252,8 @@ scm_init_posix ()
#include "libguile/cpp-SIG.c"
#include "libguile/posix.x"
scm_c_atfork_lock_static_mutex (&scm_i_locale_mutex);
}
/*

View file

@ -2333,6 +2333,8 @@ scm_init_strings ()
{
scm_nullstr = scm_i_make_string (0, NULL, 0);
scm_c_atfork_lock_static_mutex (&stringbuf_write_mutex);
#include "libguile/strings.x"
}

View file

@ -2194,6 +2194,10 @@ scm_init_threads ()
threads_initialized_p = 1;
dynwind_critical_section_mutex = scm_make_recursive_mutex ();
scm_c_atfork_lock_static_mutex (&scm_i_critical_section_mutex);
scm_c_atfork_lock_static_mutex (&scm_i_misc_mutex);
scm_c_atfork_lock_static_mutex (&thread_admin_mutex);
}
void