diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2002-12-18 10:53:23 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2002-12-18 10:53:23 +0000 |
commit | e29e0b0963a6b659f70d78271d2c40e9e2de28e7 (patch) | |
tree | 83b0413167341f34109e1b9f2df2674003027a53 /libguile/threads.c | |
parent | dad981029a145d7a8854124a558d66a68675ce1f (diff) | |
download | guile-e29e0b0963a6b659f70d78271d2c40e9e2de28e7.tar.gz |
* threads.c (really_launch): Detach before unlocking
thread_admin_mutex in order not to risk being joined.
(scm_i_thread_put_to_sleep, scm_i_thread_wake_up): Keep
thread_admin_mutex locked during GC.
* pthread-threads.c, pthread-threads.h: Improvements to debugging
functions.
Diffstat (limited to 'libguile/threads.c')
-rw-r--r-- | libguile/threads.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/libguile/threads.c b/libguile/threads.c index dee62c501..0d277c125 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -346,9 +346,9 @@ really_launch (SCM_STACKITEM *base, launch_data *data) all_threads = scm_delq_x (thread, all_threads); t->exited = 1; thread_count--; - scm_i_plugin_mutex_unlock (&thread_admin_mutex); - + /* detach before unlocking in order to not become joined when detached */ scm_thread_detach (t->thread); + scm_i_plugin_mutex_unlock (&thread_admin_mutex); } static void * @@ -1262,14 +1262,13 @@ scm_i_thread_put_to_sleep () scm_i_plugin_mutex_lock (&t->heap_mutex); } scm_i_thread_go_to_sleep = 0; - scm_i_plugin_mutex_unlock (&thread_admin_mutex); } } void scm_i_thread_invalidate_freelists () { - /* Don't need to lock thread_admin_mutex here since we are sinle threaded */ + /* Don't need to lock thread_admin_mutex here since we are single threaded */ SCM threads = all_threads; for (; !SCM_NULLP (threads); threads = SCM_CDR (threads)) if (SCM_CAR (threads) != cur_thread) @@ -1285,8 +1284,6 @@ scm_i_thread_wake_up () if (threads_initialized_p && !--gc_section_count) { SCM threads; - /* Need to lock since woken threads can die and be deleted from list */ - scm_i_plugin_mutex_lock (&thread_admin_mutex); threads = all_threads; scm_i_plugin_cond_broadcast (&wake_up_cond); for (; !SCM_NULLP (threads); threads = SCM_CDR (threads)) |