Tobias Pape uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-tonyg.1059.mcz==================== Summary ====================
Name: Kernel-tonyg.1059
Author: tonyg
Time: 17 February 2017, 2:10:00.316749 pm
UUID: 75619647-2c74-47e9-bbd4-adb402acfd2d
Ancestors: Kernel-ul.1058
Change Promise>>wait to signal BrokenPromise if the promise is rejected.
=============== Diff against Kernel-ul.1058 ===============
Item was added:
+ Error subclass: #BrokenPromise
+ instanceVariableNames: 'promise'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Kernel-Exceptions'!
+
+ !BrokenPromise commentStamp: 'tonyg 2/17/2017 13:53' prior: 0!
+ I am signalled when, during a Promise>>wait, the promise is rejected.
+ promise: the promise itself.
+ !
Item was added:
+ ----- Method: BrokenPromise>>defaultAction (in category 'as yet unclassified') -----
+ defaultAction
+ self messageText: 'Promise was rejected'.
+ ^super defaultAction!
Item was added:
+ ----- Method: BrokenPromise>>isResumable (in category 'as yet unclassified') -----
+ isResumable
+ ^ true!
Item was added:
+ ----- Method: BrokenPromise>>promise (in category 'as yet unclassified') -----
+ promise
+ ^ promise!
Item was added:
+ ----- Method: BrokenPromise>>promise: (in category 'as yet unclassified') -----
+ promise: aPromise
+ promise := aPromise!
Item was changed:
----- Method: Promise>>wait (in category 'waiting') -----
wait
+ "Wait unconditionally for this promise to become fulfilled or rejected."
- "Wait unconditionally for this promise to resolve."
| sema |
sema := Semaphore new.
self whenResolved:[sema signal].
+ self whenRejected:[sema signal].
sema wait.
+ ^ self isResolved
+ ifTrue: [ value ]
+ ifFalse: [ BrokenPromise new promise: self; signal ]!
- ^value!