equal
deleted
inserted
replaced
210 (*shutdown*) |
210 (*shutdown*) |
211 val continue = not (! do_shutdown andalso null (! workers)); |
211 val continue = not (! do_shutdown andalso null (! workers)); |
212 val _ = if continue then () else scheduler := NONE; |
212 val _ = if continue then () else scheduler := NONE; |
213 |
213 |
214 val _ = notify_all (); |
214 val _ = notify_all (); |
215 val _ = interruptible (fn () => wait_timeout (Time.fromSeconds 1)) () |
215 val _ = interruptible (fn () => |
|
216 wait_timeout (Time.fromMilliseconds (if null (! canceled) then 1000 else 50))) () |
216 handle Exn.Interrupt => List.app do_cancel (Task_Queue.cancel_all (! queue)); |
217 handle Exn.Interrupt => List.app do_cancel (Task_Queue.cancel_all (! queue)); |
217 in continue end; |
218 in continue end; |
218 |
219 |
219 fun scheduler_loop () = |
220 fun scheduler_loop () = |
220 while SYNCHRONIZED "scheduler" scheduler_next do (); |
221 while SYNCHRONIZED "scheduler" scheduler_next do (); |