157 " |
156 " |
158 ! ! |
157 ! ! |
159 |
158 |
160 !Future methodsFor:'evaluating'! |
159 !Future methodsFor:'evaluating'! |
161 |
160 |
162 block: aBlock |
161 block:aBlock |
163 "Execute aBlock in parallel with whatever called me, but |
162 "Execute aBlock in parallel with whatever called me, but |
164 ensure that any messages sent to me before execution |
163 ensure that any messages sent to me before execution |
165 of the block has terminated are suspended until it has terminated." |
164 of the block has terminated are suspended until it has terminated." |
166 |
165 |
167 semaphore := Semaphore new name:'Future'. |
166 semaphore := Semaphore new name:'Future'. |
168 [result := aBlock ensure:[semaphore signal]] fork |
167 [result := aBlock ensure:[semaphore signal]] fork |
169 ! |
168 |
170 |
169 "Modified (format): / 04-10-2011 / 14:54:11 / cg" |
171 block: aBlock value: aValue |
170 ! |
172 "Execute aBlock in parallel with whatever called me, but |
171 |
173 ensure that any messages sent to me before execution |
172 block:aBlock value:aValue |
174 of the block has terminated are suspended until it has terminated." |
173 "Execute aBlock in parallel with whatever called me, but |
175 |
174 ensure that any messages sent to me before execution |
176 semaphore := Semaphore new name:'Future'. |
175 of the block has terminated are suspended until it has terminated." |
177 [ |
176 |
178 result := [ |
177 semaphore := Semaphore new name:'Future'. |
179 aBlock value:aValue |
178 [ |
180 ] ensure:[semaphore signal] |
179 result := [ |
|
180 aBlock value:aValue |
|
181 ] ensure:[semaphore signal] |
181 ] fork |
182 ] fork |
182 ! |
183 |
183 |
184 "Modified (format): / 04-10-2011 / 14:54:18 / cg" |
184 block: aBlock value: value1 value: value2 |
185 ! |
185 "Execute aBlock in parallel with whatever called me, but |
186 |
186 ensure that any messages sent to me before execution |
187 block:aBlock value:value1 value:value2 |
187 of the block has terminated are suspended until it has terminated." |
188 "Execute aBlock in parallel with whatever called me, but |
188 |
189 ensure that any messages sent to me before execution |
189 semaphore := Semaphore new name:'Future'. |
190 of the block has terminated are suspended until it has terminated." |
190 [ |
191 |
191 result := [ |
192 semaphore := Semaphore new name:'Future'. |
192 aBlock value: value1 value: value2 |
193 [ |
193 ] ensure:[semaphore signal] |
194 result := [ |
|
195 aBlock value:value1 value:value2 |
|
196 ] ensure:[semaphore signal] |
194 ] fork |
197 ] fork |
195 ! |
198 |
196 |
199 "Modified (format): / 04-10-2011 / 14:54:28 / cg" |
197 block: aBlock value: value1 value: value2 value: value3 |
200 ! |
198 "Execute aBlock in parallel with whatever called me, but |
201 |
199 ensure that any messages sent to me before execution |
202 block:aBlock value:value1 value:value2 value:value3 |
200 of the block has terminated are suspended until it has terminated." |
203 "Execute aBlock in parallel with whatever called me, but |
201 |
204 ensure that any messages sent to me before execution |
202 semaphore := Semaphore new name:'Future'. |
205 of the block has terminated are suspended until it has terminated." |
203 [ |
206 |
204 result := [ |
207 semaphore := Semaphore new name:'Future'. |
205 aBlock value: value1 value: value2 value: value3 |
208 [ |
206 ] ensure:[semaphore signal] |
209 result := [ |
|
210 aBlock value:value1 value:value2 value:value3 |
|
211 ] ensure:[semaphore signal] |
207 ] fork |
212 ] fork |
|
213 |
|
214 "Modified (format): / 04-10-2011 / 14:54:45 / cg" |
208 ! |
215 ! |
209 |
216 |
210 block: aBlock valueWithArguments: anArray |
217 block: aBlock valueWithArguments: anArray |
211 "Execute aBlock in parallel with whatever called me, but |
218 "Execute aBlock in parallel with whatever called me, but |
212 ensure that any messages sent to me before execution |
219 ensure that any messages sent to me before execution |
216 [ |
223 [ |
217 result := [ |
224 result := [ |
218 aBlock valueWithArguments: anArray |
225 aBlock valueWithArguments: anArray |
219 ] ensure:[semaphore signal] |
226 ] ensure:[semaphore signal] |
220 ] fork |
227 ] fork |
|
228 ! |
|
229 |
|
230 priority:prio block: aBlock |
|
231 "Execute aBlock in parallel with whatever called me, but |
|
232 ensure that any messages sent to me before execution |
|
233 of the block has terminated are suspended until it has terminated." |
|
234 |
|
235 semaphore := Semaphore new name:'Future'. |
|
236 [ |
|
237 result := aBlock ensure:[semaphore signal] |
|
238 ] forkAt:prio |
|
239 |
|
240 "Created: / 04-10-2011 / 14:53:21 / cg" |
|
241 ! |
|
242 |
|
243 priority:prio block: aBlock value: aValue |
|
244 "Execute aBlock in parallel with whatever called me, but |
|
245 ensure that any messages sent to me before execution |
|
246 of the block has terminated are suspended until it has terminated." |
|
247 |
|
248 semaphore := Semaphore new name:'Future'. |
|
249 [ |
|
250 result := [ |
|
251 aBlock value:aValue |
|
252 ] ensure:[semaphore signal] |
|
253 ] forkAt:prio |
|
254 |
|
255 "Created: / 04-10-2011 / 14:53:35 / cg" |
|
256 ! |
|
257 |
|
258 priority:prio block:aBlock value:value1 value:value2 |
|
259 "Execute aBlock in parallel with whatever called me, but |
|
260 ensure that any messages sent to me before execution |
|
261 of the block has terminated are suspended until it has terminated." |
|
262 |
|
263 semaphore := Semaphore new name:'Future'. |
|
264 [ |
|
265 result := [ |
|
266 aBlock value:value1 value:value2 |
|
267 ] ensure:[semaphore signal] |
|
268 ] forkAt:prio |
|
269 |
|
270 "Created: / 04-10-2011 / 14:54:03 / cg" |
|
271 ! |
|
272 |
|
273 priority:prio block:aBlock value:value1 value:value2 value:value3 |
|
274 "Execute aBlock in parallel with whatever called me, but |
|
275 ensure that any messages sent to me before execution |
|
276 of the block has terminated are suspended until it has terminated." |
|
277 |
|
278 semaphore := Semaphore new name:'Future'. |
|
279 [ |
|
280 result := [ |
|
281 aBlock value:value1 value:value2 value:value3 |
|
282 ] ensure:[semaphore signal] |
|
283 ] forkAt:prio |
|
284 |
|
285 "Created: / 04-10-2011 / 14:54:51 / cg" |
221 ! ! |
286 ! ! |
222 |
287 |
223 !Future methodsFor:'synchronising'! |
288 !Future methodsFor:'synchronising'! |
224 |
289 |
225 doesNotUnderstand:aMessage |
290 doesNotUnderstand:aMessage |