unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Guile, pthreads and garbage collection
@ 2002-05-13 15:55 Michael J. Barillier
  2002-05-13 23:42 ` Neil Jerram
  0 siblings, 1 reply; 2+ messages in thread
From: Michael J. Barillier @ 2002-05-13 15:55 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-05-13 23:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-13 15:55 Guile, pthreads and garbage collection Michael J. Barillier
2002-05-13 23:42 ` Neil Jerram

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).