[squeak-dev] Thread Safe Collections

Guillermo Adrián Molina guille at losmolina.com.ar
Thu Apr 24 10:16:59 UTC 2008


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
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:


Or doing an entirely new hierarchy like this (with Traits to implement
similar behavior):


What do you think?


More information about the Squeak-dev mailing list