unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Trouble joining with threads from C
@ 2011-03-07  5:56 Mark H Weaver
  2011-03-09  6:48 ` Mark H Weaver
  0 siblings, 1 reply; 12+ messages in thread
From: Mark H Weaver @ 2011-03-07  5:56 UTC (permalink / raw)
  To: guile-devel

[-- Attachment #1: Type: text/plain, Size: 444 bytes --]

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



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Minimal example code --]
[-- Type: text/x-csrc, Size: 481 bytes --]

#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;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-04-25 14:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-07  5:56 Trouble joining with threads from C Mark H Weaver
2011-03-09  6:48 ` Mark H Weaver
2011-03-18 12:23   ` Andy Wingo
2011-03-20 23:11     ` Ludovic Courtès
2011-04-13 21:25       ` Ludovic Courtès
2011-04-13 21:34         ` Ludovic Courtès
2011-04-15  8:41           ` Andy Wingo
2011-04-15 21:44             ` Ludovic Courtès
2011-04-16 15:55               ` Andy Wingo
2011-04-25 13:53             ` Ludovic Courtès
2011-04-25 14:19               ` Andy Wingo
2011-04-25 14:49                 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).