From: "Michael J. Barillier" <blackwolf@pcisys.net>
Subject: Guile, pthreads and garbage collection
Date: 13 May 2002 09:55:10 -0600 [thread overview]
Message-ID: <871ycgavq9.fsf@shadizar.dyndns.org> (raw)
I'm designing an app with a background thread that access Guile SMOBs.
If I'm running code in a pthread, can I trust Guile not to garbage
collect a value while I'm accessing the content of the data structure
under the SMOB?
In particular, suppose I have a (Guile/Scheme) symbol whose value I'm
squirreling away in a global SCM (C) variable. If the symbol gets
garbage collected in the main thread (no more active references) but
in the background thread I'm busy working with the C data structure,
how can I protect that structure from the free_foosmob() (or whatever)
call? I've tried to come up with some solutions involving mutexes,
but it gets real hokey real fast. From reading the Guile docs, it
appears that Guile scans the stack and marks any SCMs it finds on the
stack. Unfortunately, in my case, the values I'm working with are
stored in a dynamically sized buffer--does the garbage collector also
run through the heap? (This seems kinda expensive ...)
Or, am I worrying needlessly about something that will never happen?
Suggestions appreciated--thanks.
--
Michael J. Barillier
(let ((n "blackwolf") (h "pcisys.net")) (concatenate 'string n "@" h))
GnuPG public key ID: 0x35E54973
Fingerprint: EDB9 4FBC 4D0B 070C C0E3 2EE4 D822 78CE 35E5 4973
Knowledge shared is power lost. -- Aleister Crowley
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2002-05-13 15:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-13 15:55 Michael J. Barillier [this message]
2002-05-13 23:42 ` Guile, pthreads and garbage collection Neil Jerram
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=871ycgavq9.fsf@shadizar.dyndns.org \
--to=blackwolf@pcisys.net \
/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).