Hi Andy! Thanks for your explanations.
Andy Wingo <[email protected]> writes: > On Wed 13 Apr 2011 23:34, [email protected] (Ludovic Courtès) writes: > >> After reviewing f60a7648d5926555c7760364a6fbb7dc0cf60720 (which >> addressed the same issue), I lean towards reverting it and instead >> applying the patch I just sent. >> >> The problem I see with f60a7648d5926555c7760364a6fbb7dc0cf60720 is that >> it re-introduces a pthread_key, even when using TLS, and make things a >> bit complex IMO. > > The issue is that threads in Guile are not always spawned by Guile. > It's true that of the two cases in which Guile spawned a thread, one of > them wasn't getting the cleanup handlers called, and your patch fixes > that; but that ignores the case of threads that are spawned by a user's > program. Right, I was just focusing on Mark’s case, blissfully ignoring #32436. > For example in the following program: > > void* thread (void*) > { > scm_with_guile (do_something, NULL); > scm_with_guile (do_something_else, NULL); > return NULL; > } > > int main () > { > pthread_t thr; > pthread_create (&thr, NULL, thread, NULL); > pthread_join (thr, NULL); > return 0; > } > > When do you propose that the cleanup handlers for the thread be called? I’ll followup on this later, but currently it seems impossible to call GC_INIT from a thread other than the initial thread [0]. Thanks, Ludo’. [0] http://article.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/4490
