[squeak-dev] WeakArray and use of weak collections.
Gary Chambers
gazzaguru2 at btinternet.com
Mon Feb 25 15:56:50 UTC 2008
If you can think of a better way of blocking if finalization is in progress... only WeakRegistry has its own protection semaphore at present. (uses WeakKeyDictionary, rather than Identity, oddly).
> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org]On Behalf Of Igor
> Stasenko
> Sent: 25 February 2008 3:34 PM
> To: The general-purpose Squeak developers list
> Subject: Re: [squeak-dev] WeakArray and use of weak collections.
>
>
> On 25/02/2008, Gary Chambers <gazzaguru2 at btinternet.com> wrote:
> > Today I've had "fun" trying to fix a problem with our software
> (that uses
> > many processes running at various priorities). Due to the use of a
> > WeakIdentitykeyDictionary I was running into problems witht
> the dictionary
> > having multiple identical keys... not pleasant, especially
> when it gets to
> > around 27000 entries (should be 20).
> >
> > I have traced the problem to the fact that finalisation is not
> thread-safe
> > with respect to access of said dictionary. As a fix I have
> implemented a
> > #critical: method on the WeakArray class that evaluates the
> given block with
> > a #critical: call on the FinalizationLock of WeakArray.
> >
> > Access to the weak dictionary is now wrapped with a WeakArray critical:
> > [...] and the problems have, thankfully, disappeared.
>
> Is this means, that if i'm having multiple instances of WeakArray, i
> can access only to one of them at given point of time?
> If so, then it's bad :)
>
> >
> > I can post a Mantis entry for this if you all think it is
> appropriate. Just
> > wondering how many other places in existing Squeak code might
> trip up on
> > this.
> >
> > Regards, Gary.
> >
> >
> >
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
More information about the Squeak-dev
mailing list
|