diff options
author | Andy Wingo <wingo@pobox.com> | 2016-11-05 00:22:15 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-11-05 00:22:15 +0100 |
commit | a3d0a7da4d2a78a7bddbac7a93648835d8419e8f (patch) | |
tree | 298b45dbccf488c8344edcac851bffa10b5ec1b8 | |
parent | 857aa581a245f49946baa9b5ce25ab3fdb2f15af (diff) |
Remove thread held pthread_mutex field
* libguile/threads.h (scm_i_thread):
* libguile/threads.c (guilify_self_1, on_thread_exit)
(scm_pthread_cond_wait, scm_pthread_cond_timedwait): The thread-local
held_mutex field is no longer needed, now that we cancel threads via
interrupts instead of pthread_cancel.
-rw-r--r-- | libguile/threads.c | 27 | ||||
-rw-r--r-- | libguile/threads.h | 1 |
2 files changed, 2 insertions, 26 deletions
diff --git a/libguile/threads.c b/libguile/threads.c index 76abe356d..d15c4e76e 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -411,7 +411,6 @@ guilify_self_1 (struct GC_stack_base *base) t.pthread = scm_i_pthread_self (); t.handle = SCM_BOOL_F; t.result = SCM_BOOL_F; - t.held_mutex = NULL; t.join_queue = SCM_EOL; t.freelists = NULL; t.pointerless_freelists = NULL; @@ -568,14 +567,6 @@ on_thread_exit (void *v) it here. */ t->guile_mode = 0; - /* If this thread was cancelled while doing a cond wait, it will - still have a mutex locked, so we unlock it here. */ - if (t->held_mutex) - { - scm_i_pthread_mutex_unlock (t->held_mutex); - t->held_mutex = NULL; - } - /* Reinstate the current thread for purposes of scm_with_guile guile-mode cleanup handlers. Only really needed in the non-TLS case but it doesn't hurt to be consistent. */ @@ -1688,14 +1679,7 @@ scm_dynwind_pthread_mutex_lock (scm_i_pthread_mutex_t *mutex) int scm_pthread_cond_wait (scm_i_pthread_cond_t *cond, scm_i_pthread_mutex_t *mutex) { - int res; - scm_i_thread *t = SCM_I_CURRENT_THREAD; - - t->held_mutex = mutex; - res = scm_i_pthread_cond_wait (cond, mutex); - t->held_mutex = NULL; - - return res; + return scm_i_pthread_cond_wait (cond, mutex); } int @@ -1703,14 +1687,7 @@ scm_pthread_cond_timedwait (scm_i_pthread_cond_t *cond, scm_i_pthread_mutex_t *mutex, const scm_t_timespec *wt) { - int res; - scm_i_thread *t = SCM_I_CURRENT_THREAD; - - t->held_mutex = mutex; - res = scm_i_pthread_cond_timedwait (cond, mutex, wt); - t->held_mutex = NULL; - - return res; + return scm_i_pthread_cond_timedwait (cond, mutex, wt); } #endif diff --git a/libguile/threads.h b/libguile/threads.h index e88a7e5c1..0aef61d22 100644 --- a/libguile/threads.h +++ b/libguile/threads.h @@ -63,7 +63,6 @@ typedef struct scm_i_thread { SCM join_queue; scm_i_pthread_mutex_t admin_mutex; - scm_i_pthread_mutex_t *held_mutex; SCM result; int exited; |