The Trunk: System-jcg.198.mcz

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

The Trunk: System-jcg.198.mcz

commits-2
Joshua Gargus uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-jcg.198.mcz

==================== Summary ====================

Name: System-jcg.198
Author: jcg
Time: 18 December 2009, 12:02:08 pm
UUID: b3f50ecc-55c7-9249-aed8-0ab34e61d6fe
Ancestors: System-ar.197

Support for using #future and #future: keywords to conveniently send asynchronous messages.

Core support is in the Kernel package, and the default behavior is defined by Project, in the System package.

=============== Diff against System-ar.197 ===============

Item was added:
+ ----- Method: Project>>future:send:at:args: (in category 'futures') -----
+ future: receiver send: aSelector at: deltaMSecs args: args
+ "Send a message deltaSeconds into the future.  Answers a Promise that will be resolved at some time in the future."
+ | pr |
+ pr := Promise new.
+ deltaMSecs = 0
+ ifTrue: [
+ self addDeferredUIMessage:
+ [pr resolveWith: (receiver perform: aSelector withArguments: args)]
+ ]
+ ifFalse: [
+ [ (Delay forMilliseconds: deltaMSecs) wait.
+ self addDeferredUIMessage:
+ [pr resolveWith: (receiver perform: aSelector withArguments: args)]
+ ] forkAt: Processor userSchedulingPriority + 1.
+ ].
+ ^pr
+ !

Item was added:
+ ----- Method: Project>>future:do:at:args: (in category 'futures') -----
+ future: receiver do: aSelector at: deltaMSecs args: args
+ "Send a message deltaSeconds into the future.  No response is expected."
+ | msg |
+ msg := MessageSend receiver: receiver selector: aSelector arguments: args.
+ deltaMSecs = 0
+ ifTrue: [self addDeferredUIMessage: msg]
+ ifFalse: [
+ [ (Delay forMilliseconds: deltaMSecs) wait.
+ self addDeferredUIMessage: msg.
+ ] forkAt: Processor userSchedulingPriority + 1.
+ ]..
+ ^nil!