[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Trouble joining with threads from C
From: |
Mark H Weaver |
Subject: |
Trouble joining with threads from C |
Date: |
Mon, 07 Mar 2011 00:56:50 -0500 |
Apologies in advance if I'm making a mistake here, but can someone
explain to me why the minimal attached example code fails to join with
its trivial spawned thread?
I might guess that it's because spawn_thread() in threads.c calls
scm_i_pthread_detach. So does launch_thread(). Yet the documentation
of scm_join_thread seems to indicate that you ought to be able to join
with a thread created by scm_spawn_thread.
Thanks,
Mark
#include <libguile.h>
static SCM
thread_main (void *data)
{
return SCM_BOOL_F;
}
static SCM
thread_handler (void *data, SCM key, SCM args)
{
return SCM_BOOL_F;
}
static void *
inner_main (void *data)
{
SCM thread = scm_spawn_thread (thread_main, 0, thread_handler, 0);
SCM timeout = scm_from_unsigned_integer (time (NULL) + 20);
scm_join_thread_timed (thread, timeout, SCM_BOOL_T);
}
int
main (int argc, char **argv)
{
scm_with_guile (inner_main, 0);
return 0;
}
- Trouble joining with threads from C,
Mark H Weaver <=