|
From: | Paul Jarc |
Subject: | Re: static variables with scheme objects |
Date: | Wed, 16 Jul 2003 14:18:22 -0400 |
User-agent: | Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux) |
sig <address@hidden> wrote: > static SCM global_mutex; > > void init() { > global_mutex = scm_make_mutex(); > } > > but it seems like doing this be dangerous as the garbage > collector would try to reclaim the object as its not an > immediate and the only reference is this global variable so > walking the stack wouldn't find it. Right. You can protect it from the garbage collector like this: global_mutex = scm_permanent_object(scm_make_mutex()); paul
[Prev in Thread] | Current Thread | [Next in Thread] |