src/Pure/Concurrent/future.ML
changeset 30666 d6248d4508d5
parent 30618 046f4f986fb5
child 31617 bb7b5a5942c7
equal deleted inserted replaced
30665:4cf38ea4fad2 30666:d6248d4508d5
   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 ();