guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-threading


From: Neil Jerram
Subject: Re: multi-threading
Date: Sat, 5 Jul 2008 23:34:22 +0100

2008/7/5 Henri Häkkinen <address@hidden>:
> Hello,
>
> I am trying to use Guile from an multi-threaded application. Here is a
> sample code:
>
> // test.c
>
> #include <libguile.h>
> #include <pthread.h>
>
> static void *
> inner_thread (void *p)
> {
>  scm_c_eval_string ("(newline)");
>  return NULL;
> }
>
> static void *
> thread (void *p)
> {
>  return scm_with_guile (inner_thread, p);
> }
>
> static void
> inner_main (void *closure, int argc, char **argv)
> {
>  pthread_t thr;
>  pthread_create (&thr, NULL, thread, NULL);
>  pthread_join (thr, NULL);
> }
>
> int
> main (int argc, char **argv)
> {
>  scm_boot_guile (argc, argv, inner_main, NULL);
>  return 0;
> }
>
>
> I have read from the Guile manual that I should be able to use threads in
> this way. However, I get ERROR: Stack overflow. Do you know where is the
> problem? Running `guile --version` returns "Guile 1.8.1".

Your program looks OK to me.  There is a known stack overflow problem
on some OSs, when just trying to load boot-9.scm, and when libguile is
compiled without much optimization.  What OS are you running on?
Also, if you could manage to test the same program with the latest
release (1.8.5), please do that and let us know the result.

         Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]