A new version of Kernel was added to project The Inbox:
http://source.squeak.org/inbox/Kernel-tonyg.1151.mcz==================== Summary ====================
Name: Kernel-tonyg.1151
Author: tonyg
Time: 9 February 2018, 12:55:51.129682 pm
UUID: b5708007-672e-4c5e-a6b6-8cfab8dab44b
Ancestors: Kernel-tonyg.1150
Update Promise >> #waitTimeoutMSecs: to stop waiting if the promise is rejected, as well as if it's accepted.
=============== Diff against Kernel-tonyg.1150 ===============
Item was changed:
----- Method: Promise>>waitTimeoutMSecs: (in category 'waiting') -----
waitTimeoutMSecs: msecs
+ "Wait for at most the given number of milliseconds for this promise to settle.
+ Answer true if it is resolved, false otherwise. False can therefore mean EITHER 'timeout' OR 'rejected'."
- "Wait for at most the given number of milliseconds for this promise to resolve. Answer true if it is resolved, false otherwise."
| sema delay |
sema := Semaphore new.
self whenResolved: [sema signal].
+ self whenRejected: [sema signal].
delay := Delay timeoutSemaphore: sema afterMSecs: msecs.
[sema wait] ensure: [delay unschedule].
^ self isResolved.!