[Pharo-project] [COTDC] 40#2 - NonReentrantWeakMessageSend

Henrik Johansen henrik.s.johansen at veloxit.no
Tue Apr 5 12:02:44 CEST 2011


NonReentrantWeakMessageSend does what it says, while the message is being executed, additional evaluations will be discarded.
It's used by when:sendOnce:to: protocol from Polymorph events, but unused in the base image.
when:send:to:exclusive: is used one place though.

It's useful when objects are mutually registered to each other's events, but the actions may lead to the others action being triggered.
Examples are 
- two lists whose contents update based on the selection in the other
- The DiffMorph (Uses ExclusiveWeakMessageSend)

ExclusiveWeakMessageSend are used when the decision whether to process an event is shared between multiple objects.
IE 2 objects respond to different events, but if received simultaneously, only the first of them should have it's action executed.

With Announcement, the corresponding functionality to non-reentrancy would be achieved using:
VW - AnnouncementCollection>>suspendWhile:  anActionBlock
Pharo - Announcer >> suspend: aSubscriber while: anActionBlock (As we neither have a specific AnnouncementCollection class, nor access to Registry itself. Not implemented yet though :P)

The shared state required to achieve Exclusivity would probably have to recide outside of the framework.

Cheers,
Henry


On Apr 4, 2011, at 9:59 56PM, laurent laffont wrote:

> Today:  NonReentrantWeakMessageSend
> 
> 
> (ExclusiveWeakMessageSend aborted - no answer)
> 
> 
> Comment Of The Day Contest - One Day One Comment
> Rules: 
> #1: Each day a not commented class is elected. Each day the best comment will be integrated with name of the author(s).
> #2: If you cannot comment it, deprecate it.
> Results: http://code.google.com/p/pharo/wiki/CommentOfTheDayContest
> 
> Laurent

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110405/0a24526f/attachment.htm>


More information about the Pharo-project mailing list