[squeak-dev] Thread Safe Collections

Germán Arduino garduino at gmail.com
Thu Apr 24 10:49:24 UTC 2008


Interesting idea.

I tend to think that more tansparent is better, but, if the overhead weren't
a problem or finding a pattern to apply (Could be a decorator?).

About your options seems that the second may be more clean, as you comment
with Traits.

Well, are only fast thoughts....


2008/4/24 Guillermo Adrián Molina <guille at losmolina.com.ar>:

> Hi!
>
> I would like to discuss an implementation of thread safe collections (and
> streams, and others).
>
> I can think on three possible approaches, the first one is to convert
> every class to be thread safe, the other is to implement new thread safe
> classes.
> I think that the first approach is interesting because the user wouldn't
> have to care about any thing to be thread safe. We would just use the
> class that is guaranteed to be thread safe by the system. But there would
> be an overhead imposed by the synchronization mechanism needed by a thread
> safe implementation.
> The second approach would let you choose between fast thread unsafe
> collections, and a slower thread safe collections. But you would have to
> choose it yourself. It would not be automatic.
> This could be done by subclassing every collection class like this:
>
> Object
> +Collection
>  +ThreadSafeCollection
>  +Bag
>  |+ThreadSafeBag
>  +Set
>  +ThreadSafeSet
>
> Or doing an entirely new hierarchy like this (with Traits to implement
> similar behavior):
>
> Object
> +Collection
> |+Bag
> |+Set
> +ThreadSafeCollection
>  +ThreadSafeBag
>  +ThreadSafeSet
>
> What do you think?
>
> Cheers
> Guille
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080424/e095ccf4/attachment.htm


More information about the Squeak-dev mailing list