# HG changeset patch # User Claus Gittinger # Date 1317732898 -7200 # Node ID fb363ea60a10629ed75dc7234602a94b5f6d44f1 # Parent 7304479a2b5975f8ce3022326c8e08a3f224a0a7 added: #priority:block: #priority:block:value: #priority:block:value:value: #priority:block:value:value:value: changed: #block: #block:value: #block:value:value: #block:value:value:value: diff -r 7304479a2b59 -r fb363ea60a10 Future.st --- a/Future.st Thu Sep 29 13:17:39 2011 +0200 +++ b/Future.st Tue Oct 04 14:54:58 2011 +0200 @@ -20,7 +20,6 @@ To: goodies-lib@cs.man.ac.uk Subject: help " - "{ Package: 'stx:libbasic2' }" ProtoObject subclass:#Future @@ -159,52 +158,60 @@ !Future methodsFor:'evaluating'! -block: aBlock +block:aBlock "Execute aBlock in parallel with whatever called me, but ensure that any messages sent to me before execution of the block has terminated are suspended until it has terminated." semaphore := Semaphore new name:'Future'. [result := aBlock ensure:[semaphore signal]] fork + + "Modified (format): / 04-10-2011 / 14:54:11 / cg" ! -block: aBlock value: aValue +block:aBlock value:aValue "Execute aBlock in parallel with whatever called me, but ensure that any messages sent to me before execution of the block has terminated are suspended until it has terminated." semaphore := Semaphore new name:'Future'. [ - result := [ - aBlock value:aValue - ] ensure:[semaphore signal] + result := [ + aBlock value:aValue + ] ensure:[semaphore signal] ] fork + + "Modified (format): / 04-10-2011 / 14:54:18 / cg" ! -block: aBlock value: value1 value: value2 +block:aBlock value:value1 value:value2 "Execute aBlock in parallel with whatever called me, but ensure that any messages sent to me before execution of the block has terminated are suspended until it has terminated." semaphore := Semaphore new name:'Future'. [ - result := [ - aBlock value: value1 value: value2 - ] ensure:[semaphore signal] + result := [ + aBlock value:value1 value:value2 + ] ensure:[semaphore signal] ] fork + + "Modified (format): / 04-10-2011 / 14:54:28 / cg" ! -block: aBlock value: value1 value: value2 value: value3 +block:aBlock value:value1 value:value2 value:value3 "Execute aBlock in parallel with whatever called me, but ensure that any messages sent to me before execution of the block has terminated are suspended until it has terminated." semaphore := Semaphore new name:'Future'. [ - result := [ - aBlock value: value1 value: value2 value: value3 - ] ensure:[semaphore signal] + result := [ + aBlock value:value1 value:value2 value:value3 + ] ensure:[semaphore signal] ] fork + + "Modified (format): / 04-10-2011 / 14:54:45 / cg" ! block: aBlock valueWithArguments: anArray @@ -218,6 +225,64 @@ aBlock valueWithArguments: anArray ] ensure:[semaphore signal] ] fork +! + +priority:prio block: aBlock + "Execute aBlock in parallel with whatever called me, but + ensure that any messages sent to me before execution + of the block has terminated are suspended until it has terminated." + + semaphore := Semaphore new name:'Future'. + [ + result := aBlock ensure:[semaphore signal] + ] forkAt:prio + + "Created: / 04-10-2011 / 14:53:21 / cg" +! + +priority:prio block: aBlock value: aValue + "Execute aBlock in parallel with whatever called me, but + ensure that any messages sent to me before execution + of the block has terminated are suspended until it has terminated." + + semaphore := Semaphore new name:'Future'. + [ + result := [ + aBlock value:aValue + ] ensure:[semaphore signal] + ] forkAt:prio + + "Created: / 04-10-2011 / 14:53:35 / cg" +! + +priority:prio block:aBlock value:value1 value:value2 + "Execute aBlock in parallel with whatever called me, but + ensure that any messages sent to me before execution + of the block has terminated are suspended until it has terminated." + + semaphore := Semaphore new name:'Future'. + [ + result := [ + aBlock value:value1 value:value2 + ] ensure:[semaphore signal] + ] forkAt:prio + + "Created: / 04-10-2011 / 14:54:03 / cg" +! + +priority:prio block:aBlock value:value1 value:value2 value:value3 + "Execute aBlock in parallel with whatever called me, but + ensure that any messages sent to me before execution + of the block has terminated are suspended until it has terminated." + + semaphore := Semaphore new name:'Future'. + [ + result := [ + aBlock value:value1 value:value2 value:value3 + ] ensure:[semaphore signal] + ] forkAt:prio + + "Created: / 04-10-2011 / 14:54:51 / cg" ! ! !Future methodsFor:'synchronising'! @@ -243,5 +308,5 @@ !Future class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic2/Future.st,v 1.11 2009-11-19 15:38:25 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic2/Future.st,v 1.12 2011-10-04 12:54:58 cg Exp $' ! !