mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-06 15:40:29 +02:00
* threads.c (scm_i_thread_invalidate_freelists): New
function. * gc.c (scm_igc): Call scm_i_thread_invalidate_freelists.
This commit is contained in:
parent
8c3300070b
commit
b0dc3d710a
4 changed files with 25 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2002-12-10 Mikael Djurfeldt <mdj@kvast.blakulla.net>
|
||||||
|
|
||||||
|
* threads.c (scm_i_thread_invalidate_freelists): New
|
||||||
|
function.
|
||||||
|
|
||||||
|
* gc.c (scm_igc): Call scm_i_thread_invalidate_freelists.
|
||||||
|
|
||||||
|
* modules.c (scm_export): Inserted a return statement.
|
||||||
|
|
||||||
2002-12-10 Han-Wen Nienhuys <hanwen@cs.uu.nl>
|
2002-12-10 Han-Wen Nienhuys <hanwen@cs.uu.nl>
|
||||||
|
|
||||||
* modules.c (scm_export): new function
|
* modules.c (scm_export): new function
|
||||||
|
|
|
@ -570,6 +570,8 @@ scm_igc (const char *what)
|
||||||
|
|
||||||
++scm_gc_heap_lock;
|
++scm_gc_heap_lock;
|
||||||
|
|
||||||
|
scm_i_thread_invalidate_freelists ();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Let's finish the sweep. The conservative GC might point into the
|
Let's finish the sweep. The conservative GC might point into the
|
||||||
garbage, and marking that would create a mess.
|
garbage, and marking that would create a mess.
|
||||||
|
|
|
@ -1158,7 +1158,6 @@ scm_c_thread_exited_p (SCM thread)
|
||||||
|
|
||||||
static scm_t_cond wake_up_cond;
|
static scm_t_cond wake_up_cond;
|
||||||
int scm_i_thread_go_to_sleep;
|
int scm_i_thread_go_to_sleep;
|
||||||
static scm_thread *gc_thread;
|
|
||||||
static scm_t_mutex gc_section_mutex;
|
static scm_t_mutex gc_section_mutex;
|
||||||
static scm_thread *gc_section_owner;
|
static scm_thread *gc_section_owner;
|
||||||
static int gc_section_count = 0;
|
static int gc_section_count = 0;
|
||||||
|
@ -1177,21 +1176,30 @@ scm_i_thread_put_to_sleep ()
|
||||||
if (SCM_CAR (threads) != cur_thread)
|
if (SCM_CAR (threads) != cur_thread)
|
||||||
{
|
{
|
||||||
scm_thread *t = SCM_THREAD_DATA (SCM_CAR (threads));
|
scm_thread *t = SCM_THREAD_DATA (SCM_CAR (threads));
|
||||||
t->clear_freelists_p = 1;
|
|
||||||
scm_i_plugin_mutex_lock (&t->heap_mutex);
|
scm_i_plugin_mutex_lock (&t->heap_mutex);
|
||||||
}
|
}
|
||||||
gc_thread = suspend ();
|
|
||||||
scm_i_thread_go_to_sleep = 0;
|
scm_i_thread_go_to_sleep = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
scm_i_thread_invalidate_freelists ()
|
||||||
|
{
|
||||||
|
SCM threads = all_threads;
|
||||||
|
for (; !SCM_NULLP (threads); threads = SCM_CDR (threads))
|
||||||
|
if (SCM_CAR (threads) != cur_thread)
|
||||||
|
{
|
||||||
|
scm_thread *t = SCM_THREAD_DATA (SCM_CAR (threads));
|
||||||
|
t->clear_freelists_p = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_i_thread_wake_up ()
|
scm_i_thread_wake_up ()
|
||||||
{
|
{
|
||||||
if (threads_initialized_p && gc_section_count == 1)
|
if (threads_initialized_p && gc_section_count == 1)
|
||||||
{
|
{
|
||||||
SCM threads = all_threads;
|
SCM threads = all_threads;
|
||||||
resume (gc_thread);
|
|
||||||
scm_i_plugin_cond_broadcast (&wake_up_cond);
|
scm_i_plugin_cond_broadcast (&wake_up_cond);
|
||||||
for (; !SCM_NULLP (threads); threads = SCM_CDR (threads))
|
for (; !SCM_NULLP (threads); threads = SCM_CDR (threads))
|
||||||
if (SCM_CAR (threads) != cur_thread)
|
if (SCM_CAR (threads) != cur_thread)
|
||||||
|
@ -1208,11 +1216,8 @@ scm_i_thread_sleep_for_gc ()
|
||||||
{
|
{
|
||||||
scm_thread *t;
|
scm_thread *t;
|
||||||
t = suspend ();
|
t = suspend ();
|
||||||
*SCM_FREELIST_LOC (scm_i_freelist) = SCM_EOL;
|
|
||||||
*SCM_FREELIST_LOC (scm_i_freelist2) = SCM_EOL;
|
|
||||||
scm_i_plugin_cond_wait (&wake_up_cond, &t->heap_mutex);
|
scm_i_plugin_cond_wait (&wake_up_cond, &t->heap_mutex);
|
||||||
t->clear_freelists_p = 0;
|
resume (t);
|
||||||
t->top = NULL; /* resume (t); but don't clear freelists */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The mother of all recursive critical sections */
|
/* The mother of all recursive critical sections */
|
||||||
|
|
|
@ -182,6 +182,7 @@ extern int scm_i_thread_go_to_sleep;
|
||||||
|
|
||||||
void scm_i_thread_put_to_sleep (void);
|
void scm_i_thread_put_to_sleep (void);
|
||||||
void scm_i_thread_wake_up (void);
|
void scm_i_thread_wake_up (void);
|
||||||
|
void scm_i_thread_invalidate_freelists (void);
|
||||||
void scm_i_thread_sleep_for_gc (void);
|
void scm_i_thread_sleep_for_gc (void);
|
||||||
void scm_threads_prehistory (void);
|
void scm_threads_prehistory (void);
|
||||||
void scm_threads_init_first_thread (void);
|
void scm_threads_init_first_thread (void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue