Promise.st
changeset 4337 167d0c973942
parent 4230 5009e3cfe732
child 4366 b52f62b48580
--- a/Promise.st	Sat Feb 18 10:49:20 2017 +0100
+++ b/Promise.st	Mon Feb 20 10:41:32 2017 +0100
@@ -102,7 +102,8 @@
 
     value := anObject.
     valueAvailable signal.
-    valueAvailable signalForAll.
+
+    "Modified: / 20-02-2017 / 10:28:23 / stefan"
 ! !
 
 !Promise methodsFor:'initialization'!
@@ -110,23 +111,21 @@
 initialize
     "setup"
 
-    valueAvailable := (Semaphore new:0) name:'valueAvailable'.
+    valueAvailable := EventSemaphore new name:'Promise.valueAvailable'.
+
+    "Modified: / 20-02-2017 / 10:37:40 / stefan"
 !
 
 value:aBlock priority:aPrio
     "setup and start the evaluation process."
 
-    valueAvailable := (Semaphore new:0) name:'valueAvailable'.
-
     [
-	ErrorSignal handle:[:ex |
-	    exception := ex.
-	    ex return.
-	] do:[
-	    value := aBlock value.
-	].
-	valueAvailable signal.
-	valueAvailable signalForAll.
+        [
+            value := aBlock value.
+        ] on:Error do:[:ex|
+            exception := ex.
+        ].
+        valueAvailable signal.
     ] forkAt:aPrio
 
     "
@@ -135,6 +134,8 @@
     "
      Promise value:[10 timesRepeat:[1000 factorial]. [self halt] value.] priority:7
     "
+
+    "Modified: / 20-02-2017 / 10:31:36 / stefan"
 ! !
 
 !Promise methodsFor:'queries'!