guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static variables with scheme objects


From: sig
Subject: Re: static variables with scheme objects
Date: Wed, 16 Jul 2003 15:04:40 -0400
User-agent: Mutt/1.2.5.1i

Thanks Paul,

Does the garbage collector actually mark and sweep items that
have been declared permanent or does it just ignore them all
together. In other words, is it ok to say:

mutex_list = scm_permanent_object(scm_list_2(scm_make_mutex(),
                                             scm_make_mutex()));

or are you required to say

mutex_list = scm_permanent_object(scm_list_2(
                       scm_permanent_object(scm_make_mutex()),
                       scm_permanent_object(scm_make_mutex())));


Also, it seems like there could be a race condition introduced
by this whole permanent_object system. If the garbage collector
gets run after scm_make_mutex but before scm_permanent_object,
then:
global_mutex = scm_permanent_object(scm_make_mutex) could end up
trying to make permanent a non existant object. Is this right,
or am I missing something?

cya
.sig

On Wed, Jul 16, 2003 at 02:18:22PM -0400, Paul Jarc wrote:
> Right.  You can protect it from the garbage collector like this:
> 
> global_mutex = scm_permanent_object(scm_make_mutex());
> 
> 
> paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]