help-smalltalk
[Top][All Lists]
Advanced

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

[Help-smalltalk] Dispatching blocks to another context and break for col


From: Holger Hans Peter Freyther
Subject: [Help-smalltalk] Dispatching blocks to another context and break for collections
Date: Tue, 28 Jun 2011 19:49:25 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b2 Thunderbird/3.1.10

Hi Paolo,

I am searching for a simple pattern and wonder if you or anyone else
encountered this and came up with a nice solution.

I have a SortedCollection (of objects that have a timestamp), I want to
process the timestamps until a certain date, I want to avoid extra copies.

Right now I use code like this:

copy do: [:each |
        each isTooOld ifTrue: [^true].
        each doStuff
        orig remove: each
].


Now I started to dispatch the block to another process (to avoid some locking
issues right now..) but obviously I get a BadReturn when invoking it in
another Context. Is there something like a 'break' for Iterable>>do:? is there
any other selector to help me?

One thing I can think of is something like this...

[copy isEmpty not and: [copy first isJounEnough]] whileTrue: [].

anything else?




reply via email to

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