equal
deleted
inserted
replaced
151 val res = |
151 val res = |
152 if ok then |
152 if ok then |
153 Exn.capture (fn () => |
153 Exn.capture (fn () => |
154 Multithreading.with_attributes Multithreading.private_interrupts (fn _ => e ())) () |
154 Multithreading.with_attributes Multithreading.private_interrupts (fn _ => e ())) () |
155 else Exn.Exn Exn.Interrupt; |
155 else Exn.Exn Exn.Interrupt; |
156 val _ = Synchronized.change result |
156 val _ = Synchronized.assign result (K (SOME res)); |
157 (fn NONE => SOME res |
|
158 | SOME _ => raise Fail "Duplicate assignment of future value"); |
|
159 in |
157 in |
160 (case res of |
158 (case res of |
161 Exn.Exn exn => (Task_Queue.cancel_group group exn; false) |
159 Exn.Exn exn => (Task_Queue.cancel_group group exn; false) |
162 | Exn.Result _ => true) |
160 | Exn.Result _ => true) |
163 end; |
161 end; |
347 | SOME (Exn.Exn Exn.Interrupt) => |
345 | SOME (Exn.Exn Exn.Interrupt) => |
348 Exn.Exn (Exn.EXCEPTIONS (Exn.flatten_list (Task_Queue.group_status (group_of x)))) |
346 Exn.Exn (Exn.EXCEPTIONS (Exn.flatten_list (Task_Queue.group_status (group_of x)))) |
349 | SOME res => res); |
347 | SOME res => res); |
350 |
348 |
351 fun join_wait x = |
349 fun join_wait x = |
352 Synchronized.guarded_access (result_of x) |
350 Synchronized.readonly_access (result_of x) (fn NONE => NONE | SOME _ => SOME ()); |
353 (fn NONE => NONE | some => SOME ((), some)); |
|
354 |
351 |
355 fun join_next deps = (*requires SYNCHRONIZED*) |
352 fun join_next deps = (*requires SYNCHRONIZED*) |
356 if null deps then NONE |
353 if null deps then NONE |
357 else |
354 else |
358 (case Unsynchronized.change_result queue (Task_Queue.dequeue_towards (Thread.self ()) deps) of |
355 (case Unsynchronized.change_result queue (Task_Queue.dequeue_towards (Thread.self ()) deps) of |