[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 11/24: Remove thread held pthread_mutex field
From: |
Andy Wingo |
Subject: |
[Guile-commits] 11/24: Remove thread held pthread_mutex field |
Date: |
Sun, 6 Nov 2016 18:00:45 +0000 (UTC) |
wingo pushed a commit to branch master
in repository guile.
commit a3d0a7da4d2a78a7bddbac7a93648835d8419e8f
Author: Andy Wingo <address@hidden>
Date: Sat Nov 5 00:22:15 2016 +0100
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.
---
libguile/threads.c | 27 ++-------------------------
libguile/threads.h | 1 -
2 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/libguile/threads.c b/libguile/threads.c
index 76abe35..d15c4e7 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 e88a7e5..0aef61d 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;
- [Guile-commits] 05/24: srfi-18 condition variables disjoint, (continued)
- [Guile-commits] 05/24: srfi-18 condition variables disjoint, Andy Wingo, 2016/11/06
- [Guile-commits] 10/24: Remove thread-local weak mutex set, Andy Wingo, 2016/11/06
- [Guile-commits] 18/24: Back to simple unlock-mutex, Andy Wingo, 2016/11/06
- [Guile-commits] 08/24: Remove lock-mutex owner facility, Andy Wingo, 2016/11/06
- [Guile-commits] 14/24: SRFI-18 mutexes are not recursive, Andy Wingo, 2016/11/06
- [Guile-commits] 07/24: SRFI-18 threads disjoint from guile threads, Andy Wingo, 2016/11/06
- [Guile-commits] 21/24: scm_timed_lock_mutex replaces scm_lock_mutex_timed, Andy Wingo, 2016/11/06
- [Guile-commits] 15/24: Recursively locking a SRFI-18 mutex blocks, Andy Wingo, 2016/11/06
- [Guile-commits] 19/24: Separate fat mutex unlock and wait operations, Andy Wingo, 2016/11/06
- [Guile-commits] 06/24: Update SRFI-18 documentation., Andy Wingo, 2016/11/06
- [Guile-commits] 11/24: Remove thread held pthread_mutex field,
Andy Wingo <=
- [Guile-commits] 13/24: Move more functionality to SRFI-18 mutex-unlock!, Andy Wingo, 2016/11/06
- [Guile-commits] 03/24: SRFI-18 mutexes disjoint from Guile mutexes, Andy Wingo, 2016/11/06
- [Guile-commits] 16/24: Remove unchecked-unlock facility from Guile mutexes, Andy Wingo, 2016/11/06
- [Guile-commits] 24/24: Update NEWS., Andy Wingo, 2016/11/06
- [Guile-commits] 22/24: Update documentation on mutexes, Andy Wingo, 2016/11/06
- [Guile-commits] 20/24: Update mutex documentation, Andy Wingo, 2016/11/06
- [Guile-commits] 17/24: Replace scm_make_mutex_with_flags, Andy Wingo, 2016/11/06
- [Guile-commits] 23/24: Minor editing in api-scheduling.texi, Andy Wingo, 2016/11/06