unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Neil Jerram" <neiljerram@googlemail.com>
To: "Henri Häkkinen" <henri.hakkinen@pp2.inet.fi>
Cc: guile-user@gnu.org
Subject: Re: multi-threading
Date: Sat, 5 Jul 2008 23:34:22 +0100	[thread overview]
Message-ID: <49dd78620807051534s3270381bs686248f7def631ea@mail.gmail.com> (raw)
In-Reply-To: <486FF23B.6000301@pp2.inet.fi>

2008/7/5 Henri Häkkinen <henri.hakkinen@pp2.inet.fi>:
> 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	other threads:[~2008-07-05 22:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-05 22:14 multi-threading Henri Häkkinen
2008-07-05 22:34 ` Neil Jerram [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49dd78620807051534s3270381bs686248f7def631ea@mail.gmail.com \
    --to=neiljerram@googlemail.com \
    --cc=guile-user@gnu.org \
    --cc=henri.hakkinen@pp2.inet.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).