2008/7/5 Henri Häkkinen <[EMAIL PROTECTED]>:
> 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