Sig, One can always construct examples in which protecting the entire loop is the better option. That's not the scenario of interest. Just as shared queues are useful, shared sets and dictionaries have value for sporadic access scenarios. Doing it your way, everyone writes their own incompletely protected (read buggy/dangerous) ad-hoc implementations of these common collections.
I favor having solid implementations that are complete and as correct as we can get them, leaving people to optimize as you suggest when it makes sense to do so. Bill -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Igor Stasenko Sent: Thursday, October 22, 2009 5:23 PM To: [email protected] Subject: Re: [Pharo-project] Thread-safe collections 2009/10/23 Schwab,Wilhelm K <[email protected]>: > Hello all, > > I just looked around for thread-safe collections, and found nothing that > looks like a shared dictionary. The squeak-dev archives contain the > obligatory newbie posts (wanting all collections to be thread safe) and the > expected replies, some of which are overly dismissive of the idea. Something > that protects things like #at:ifAbsentPut: and friends is _really_ useful. > Am I missing an existing implementation? > Imo, there's only one shared collection which is useful - shared queue. :) If you need more kinds of thread-safe collections, it probably indicating that the concurrent code (or model) which you designed is in pretty bad shape. Just compare two following snippets: 1 to: 100 do: [:i | collection threadSafeAt: i put: something]. and: semaphore critical: [ 1 to: 100 do: [:i | collection at: i put: something] ]. What you think, which one is better? > Bill > > > _______________________________________________ > Pharo-project mailing list > [email protected] > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project _______________________________________________ Pharo-project mailing list [email protected] http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
