equal
deleted
inserted
replaced
35 val shutdown_request: unit -> unit |
35 val shutdown_request: unit -> unit |
36 val future: group option -> task list -> (unit -> 'a) -> 'a T |
36 val future: group option -> task list -> (unit -> 'a) -> 'a T |
37 val fork: (unit -> 'a) -> 'a T |
37 val fork: (unit -> 'a) -> 'a T |
38 val join_results: 'a T list -> 'a Exn.result list |
38 val join_results: 'a T list -> 'a Exn.result list |
39 val join: 'a T -> 'a |
39 val join: 'a T -> 'a |
|
40 val focus: task list -> unit |
40 val cancel: 'a T -> unit |
41 val cancel: 'a T -> unit |
41 val interrupt_task: string -> unit |
42 val interrupt_task: string -> unit |
42 end; |
43 end; |
43 |
44 |
44 structure Future: FUTURE = |
45 structure Future: FUTURE = |
264 in xs |> map (fn Future {result = ref (SOME res), ...} => res) end; |
265 in xs |> map (fn Future {result = ref (SOME res), ...} => res) end; |
265 |
266 |
266 fun join x = Exn.release (singleton join_results x); |
267 fun join x = Exn.release (singleton join_results x); |
267 |
268 |
268 |
269 |
269 (* termination *) |
270 (* misc operations *) |
|
271 |
|
272 (*focus: collection of high-priority task*) |
|
273 fun focus tasks = SYNCHRONIZED "interrupt" (fn () => |
|
274 change queue (TaskQueue.focus tasks)); |
270 |
275 |
271 (*cancel: present and future group members will be interrupted eventually*) |
276 (*cancel: present and future group members will be interrupted eventually*) |
272 fun cancel x = (scheduler_check (); cancel_request (group_of x)); |
277 fun cancel x = (scheduler_check (); cancel_request (group_of x)); |
273 |
278 |
274 (*interrupt: adhoc signal, permissive, may get ignored*) |
279 (*interrupt: permissive signal, may get ignored*) |
275 fun interrupt_task id = SYNCHRONIZED "interrupt" |
280 fun interrupt_task id = SYNCHRONIZED "interrupt" |
276 (fn () => TaskQueue.interrupt_external (! queue) id); |
281 (fn () => TaskQueue.interrupt_external (! queue) id); |
277 |
282 |
278 end; |
283 end; |