From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Michael J. Barillier" Newsgroups: gmane.lisp.guile.user Subject: Guile, pthreads and garbage collection Date: 13 May 2002 09:55:10 -0600 Sender: guile-user-admin@gnu.org Message-ID: <871ycgavq9.fsf@shadizar.dyndns.org> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1021305292 10013 127.0.0.1 (13 May 2002 15:54:52 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 13 May 2002 15:54:52 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 177I9z-0002bO-00 for ; Mon, 13 May 2002 17:54:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 177I9N-0007x8-00; Mon, 13 May 2002 11:54:13 -0400 Original-Received: from moe1.meg106-11.cos.pcisys.net ([208.202.106.11] helo=shadizar.dyndns.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 177I8d-0007pa-00 for ; Mon, 13 May 2002 11:53:29 -0400 Original-Received: (from blackwolf@localhost) by shadizar.dyndns.org (8.11.6/8.11.6) id g4DFtAN01788; Mon, 13 May 2002 09:55:10 -0600 X-Authentication-Warning: shadizar.dyndns.org: blackwolf set sender to blackwolf@pcisys.net using -f Original-To: guile-user@gnu.org Original-Lines: 27 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:409 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:409 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