[COTDC] 40#2 - NonReentrantWeakMessageSend

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[COTDC] 40#2 - NonReentrantWeakMessageSend

laurent laffont
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.
Laurent
Reply | Threaded
Open this post in threaded view
|

Re: [COTDC] 40#2 - NonReentrantWeakMessageSend

Henrik Sperre Johansen
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.
Laurent

Reply | Threaded
Open this post in threaded view
|

Re: [COTDC] 40#2 - NonReentrantWeakMessageSend

laurent laffont
Thanks a lot Henrik.

Laurent.

On Tue, Apr 5, 2011 at 12:02 PM, Henrik Johansen <[hidden email]> wrote:
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.
Laurent


Reply | Threaded
Open this post in threaded view
|

Re: [COTDC] 40#2 - NonReentrantWeakMessageSend

Stéphane Ducasse
+1


On Apr 5, 2011, at 8:29 PM, laurent laffont wrote:

> Thanks a lot Henrik.
>
> Laurent.
>
> On Tue, Apr 5, 2011 at 12:02 PM, Henrik Johansen <[hidden email]> wrote:
> 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
>
>