diff options
author | Andy Wingo <wingo@pobox.com> | 2016-10-31 22:37:46 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-10-31 22:37:46 +0100 |
commit | eeeee3297b8d4cb0717ee3b9ae5068b4f0b7f118 (patch) | |
tree | 8ffa02e98e442ba94d803768de8b48c2839b4cd4 /libguile/threads.c | |
parent | 94a3433b9d1da4acf2737aa1db8ce129b90623d9 (diff) |
Remove thread cleanup facility
* NEWS: Add entry.
* doc/ref/api-scheduling.texi (Threads): Remove thread-cleanup docs.
* libguile/threads.c (guilify_self_1, do_thread_exit):
(scm_set_thread_cleanup_x, scm_thread_cleanup): Remove these.
* libguile/threads.h (scm_i_thread): Remove cleanup_handler.
* module/ice-9/threads.scm:
* module/ice-9/deprecated.scm (thread-cleanup, set-thread-cleanup!):
Remove.
* test-suite/tests/threads.test: Adapt to test cancel-thread return
values and not test thread-cleanup procs.
Diffstat (limited to 'libguile/threads.c')
-rw-r--r-- | libguile/threads.c | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/libguile/threads.c b/libguile/threads.c index 8ac0832c5..37381cbbd 100644 --- a/libguile/threads.c +++ b/libguile/threads.c @@ -408,7 +408,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.cleanup_handler = SCM_BOOL_F; t.mutexes = SCM_EOL; t.held_mutex = NULL; t.join_queue = SCM_EOL; @@ -527,13 +526,6 @@ typedef struct { #define SCM_MUTEXP(x) SCM_SMOB_PREDICATE (scm_tc16_mutex, x) #define SCM_MUTEX_DATA(x) ((fat_mutex *) SCM_SMOB_DATA (x)) -static SCM -call_cleanup (void *data) -{ - SCM *proc_p = data; - return scm_call_0 (*proc_p); -} - /* Perform thread tear-down, in guile mode. */ static void * @@ -541,16 +533,6 @@ do_thread_exit (void *v) { scm_i_thread *t = (scm_i_thread *) v; - if (!scm_is_false (t->cleanup_handler)) - { - SCM ptr = t->cleanup_handler; - - t->cleanup_handler = SCM_BOOL_F; - t->result = scm_internal_catch (SCM_BOOL_T, - call_cleanup, &ptr, - scm_handle_by_message_noexit, NULL); - } - scm_i_scm_pthread_mutex_lock (&t->admin_mutex); t->exited = 1; @@ -1020,49 +1002,6 @@ scm_cancel_thread (SCM thread) return SCM_UNSPECIFIED; } -SCM_DEFINE (scm_set_thread_cleanup_x, "set-thread-cleanup!", 2, 0, 0, - (SCM thread, SCM proc), -"Set the thunk @var{proc} as the cleanup handler for the thread @var{thread}. " -"This handler will be called when the thread exits.") -#define FUNC_NAME s_scm_set_thread_cleanup_x -{ - scm_i_thread *t; - - SCM_VALIDATE_THREAD (1, thread); - if (!scm_is_false (proc)) - SCM_VALIDATE_THUNK (2, proc); - - t = SCM_I_THREAD_DATA (thread); - scm_i_pthread_mutex_lock (&t->admin_mutex); - - if (!t->exited) - t->cleanup_handler = proc; - - scm_i_pthread_mutex_unlock (&t->admin_mutex); - - return SCM_UNSPECIFIED; -} -#undef FUNC_NAME - -SCM_DEFINE (scm_thread_cleanup, "thread-cleanup", 1, 0, 0, - (SCM thread), -"Return the cleanup handler installed for the thread @var{thread}.") -#define FUNC_NAME s_scm_thread_cleanup -{ - scm_i_thread *t; - SCM ret; - - SCM_VALIDATE_THREAD (1, thread); - - t = SCM_I_THREAD_DATA (thread); - scm_i_pthread_mutex_lock (&t->admin_mutex); - ret = t->exited ? SCM_BOOL_F : t->cleanup_handler; - scm_i_pthread_mutex_unlock (&t->admin_mutex); - - return ret; -} -#undef FUNC_NAME - SCM scm_join_thread (SCM thread) { return scm_join_thread_timed (thread, SCM_UNDEFINED, SCM_UNDEFINED); |