fix thread cleanup
authorAndy Wingo <wingo@pobox.com>
Fri, 18 Mar 2011 12:18:47 +0000 (13:18 +0100)
committerAndy Wingo <wingo@pobox.com>
Fri, 18 Mar 2011 12:29:02 +0000 (13:29 +0100)
commitf60a7648d5926555c7760364a6fbb7dc0cf60720
tree289783b1ae89962da6dbdf6772182fc5d8049787
parent60582b7c2a495957012f9a20cd8691dc6307a850
fix thread cleanup

* libguile/threads.h: Always declare a scm_i_thread_key, for cleanup
  purposes, in the BUILDING_LIBGUILE case.

* libguile/threads.c (scm_i_thread_key): Init with a cleanup handler, so
  any guile-specific info for a thread can be cleaned up reliably.
  (guilify_self_1): Always set the thread key.
  (do_thread_exit_trampoline, on_thread_exit): Enter guile-mode for the
  guile-mode cleanup handler, and trampoline through a
  gc_call_with_stack_base for reasons explained in the code.
  (init_thread_key, scm_i_init_thread_for_guile): Always init the key.
  (scm_i_with_guile_and_parent): No need for pthread_cancel cleanup
  handlers, as the pthread key destructor will take care of that for
  us.
  (really_launch): Remove needless pthread_exit call with incorrect
  comment.
libguile/threads.c
libguile/threads.h