1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

fix initial values of reallocated fluids

* libguile/threads.h:
* libguile/threads.c (scm_i_reset_fluid): New internal function, resets
  the binding of a fluid for all threads.  Needed for fluid GC.

* libguile/fluids.c (new_fluid): Call scm_i_reset_fluid here.
This commit is contained in:
Andy Wingo 2011-06-16 19:35:14 +02:00
parent 2dd4948644
commit 0b77014f0c
3 changed files with 24 additions and 0 deletions

View file

@ -484,6 +484,24 @@ static int thread_count;
static SCM scm_i_default_dynamic_state;
/* Run when a fluid is collected. */
void
scm_i_reset_fluid (size_t n, SCM val)
{
scm_i_thread *t;
scm_i_pthread_mutex_lock (&thread_admin_mutex);
for (t = all_threads; t; t = t->next_thread)
if (SCM_I_DYNAMIC_STATE_P (t->dynamic_state))
{
SCM v = SCM_I_DYNAMIC_STATE_FLUIDS (t->dynamic_state);
if (n < SCM_SIMPLE_VECTOR_LENGTH (v))
SCM_SIMPLE_VECTOR_SET (v, n, val);
}
scm_i_pthread_mutex_unlock (&thread_admin_mutex);
}
/* Perform first stage of thread initialisation, in non-guile mode.
*/
static void