mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +02:00
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.
This commit is contained in:
parent
857aa581a2
commit
a3d0a7da4d
2 changed files with 2 additions and 26 deletions
|
@ -411,7 +411,6 @@ guilify_self_1 (struct GC_stack_base *base)
|
||||||
t.pthread = scm_i_pthread_self ();
|
t.pthread = scm_i_pthread_self ();
|
||||||
t.handle = SCM_BOOL_F;
|
t.handle = SCM_BOOL_F;
|
||||||
t.result = SCM_BOOL_F;
|
t.result = SCM_BOOL_F;
|
||||||
t.held_mutex = NULL;
|
|
||||||
t.join_queue = SCM_EOL;
|
t.join_queue = SCM_EOL;
|
||||||
t.freelists = NULL;
|
t.freelists = NULL;
|
||||||
t.pointerless_freelists = NULL;
|
t.pointerless_freelists = NULL;
|
||||||
|
@ -568,14 +567,6 @@ on_thread_exit (void *v)
|
||||||
it here. */
|
it here. */
|
||||||
t->guile_mode = 0;
|
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
|
/* Reinstate the current thread for purposes of scm_with_guile
|
||||||
guile-mode cleanup handlers. Only really needed in the non-TLS
|
guile-mode cleanup handlers. Only really needed in the non-TLS
|
||||||
case but it doesn't hurt to be consistent. */
|
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
|
int
|
||||||
scm_pthread_cond_wait (scm_i_pthread_cond_t *cond, scm_i_pthread_mutex_t *mutex)
|
scm_pthread_cond_wait (scm_i_pthread_cond_t *cond, scm_i_pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
int res;
|
return scm_i_pthread_cond_wait (cond, mutex);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -1703,14 +1687,7 @@ scm_pthread_cond_timedwait (scm_i_pthread_cond_t *cond,
|
||||||
scm_i_pthread_mutex_t *mutex,
|
scm_i_pthread_mutex_t *mutex,
|
||||||
const scm_t_timespec *wt)
|
const scm_t_timespec *wt)
|
||||||
{
|
{
|
||||||
int res;
|
return scm_i_pthread_cond_timedwait (cond, mutex, wt);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -63,7 +63,6 @@ typedef struct scm_i_thread {
|
||||||
SCM join_queue;
|
SCM join_queue;
|
||||||
|
|
||||||
scm_i_pthread_mutex_t admin_mutex;
|
scm_i_pthread_mutex_t admin_mutex;
|
||||||
scm_i_pthread_mutex_t *held_mutex;
|
|
||||||
|
|
||||||
SCM result;
|
SCM result;
|
||||||
int exited;
|
int exited;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue