From: Mark H Weaver <mhw@netris.org>
To: Sheheryar Parvaz <skipper308@hotmail.ca>
Cc: "30261@debbugs.gnu.org" <30261@debbugs.gnu.org>
Subject: bug#30261: segfault on simultaneous initialization
Date: Sat, 27 Jan 2018 15:27:21 -0500 [thread overview]
Message-ID: <87vafnoxna.fsf@netris.org> (raw)
In-Reply-To: <CY4PR13MB15919CE881BCB5EB10C044E8F1E70@CY4PR13MB1591.namprd13.prod.outlook.com> (Sheheryar Parvaz's message of "Sat, 27 Jan 2018 00:58:06 +0000")
Sheheryar Parvaz <skipper308@hotmail.ca> wrote:
> If the initial call to scm_with_guile is on a thread and in the main
> thread at the same time, a segmentation fault occurs.
Mark H Weaver <mhw@netris.org> wrote:
> Yes, this is a known issue. At present, Guile must be fully initialized
> in one thread before it can be safely used from any other thread.
> Furthermore, when loading modules, you must ensure that no other thread
> attempts to load or use the same module while it's being loaded. If
> possible, please arrange to load all modules that your program will need
> before accessing Guile from other threads.
Sheheryar Parvaz <skipper308@hotmail.ca> writes:
> Are there any decent workarounds for this? I considered
> scm_init_guile, however according to the documentation, it is
> non-portable. For modules, I have no idea how I would initialize them.
The usual approach is to initialize Guile before spawning any other
threads. You can do this by calling 'scm_with_guile' early in your
'main', and then moving most of the contents of your 'main' into the
inner function that 'scm_with_guile' calls.
If there are modules that you'll need to load from your threaded code,
then load them before spawning any threads, from within the inner
function that 'scm_with_guile' calls. From C, you can load modules with
'scm_c_resolve_module'.
Mark
prev parent reply other threads:[~2018-01-27 20:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-26 17:24 bug#30261: segfault on simultaneous initialization Sheheryar Parvaz
2018-01-26 23:41 ` Mark H Weaver
2018-01-27 0:58 ` Sheheryar Parvaz
2018-01-27 20:27 ` Mark H Weaver [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=87vafnoxna.fsf@netris.org \
--to=mhw@netris.org \
--cc=30261@debbugs.gnu.org \
--cc=skipper308@hotmail.ca \
/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).