src/Pure/Concurrent/future.ML
changeset 50429 f8cd5e53653b
parent 50280 0eb9b5d09f31
child 50664 fff984a77f58
equal deleted inserted replaced
50428:7a78a74139f5 50429:f8cd5e53653b
   383 
   383 
   384     (* shutdown *)
   384     (* shutdown *)
   385 
   385 
   386     val _ = if Task_Queue.all_passive (! queue) then do_shutdown := true else ();
   386     val _ = if Task_Queue.all_passive (! queue) then do_shutdown := true else ();
   387     val continue = not (! do_shutdown andalso null (! workers));
   387     val continue = not (! do_shutdown andalso null (! workers));
   388     val _ = if continue then () else scheduler := NONE;
   388     val _ = if continue then () else (report_status (); scheduler := NONE);
   389 
   389 
   390     val _ = broadcast scheduler_event;
   390     val _ = broadcast scheduler_event;
   391   in continue end
   391   in continue end
   392   handle exn =>
   392   handle exn =>
   393     if Exn.is_interrupt exn then
   393     if Exn.is_interrupt exn then
   399 fun scheduler_loop () =
   399 fun scheduler_loop () =
   400  (while
   400  (while
   401     Multithreading.with_attributes
   401     Multithreading.with_attributes
   402       (Multithreading.sync_interrupts Multithreading.public_interrupts)
   402       (Multithreading.sync_interrupts Multithreading.public_interrupts)
   403       (fn _ => SYNCHRONIZED "scheduler" (fn () => scheduler_next ()))
   403       (fn _ => SYNCHRONIZED "scheduler" (fn () => scheduler_next ()))
   404   do (); last_round := Time.zeroTime; report_status ());
   404   do (); last_round := Time.zeroTime);
   405 
   405 
   406 fun scheduler_active () = (*requires SYNCHRONIZED*)
   406 fun scheduler_active () = (*requires SYNCHRONIZED*)
   407   (case ! scheduler of NONE => false | SOME thread => Thread.isActive thread);
   407   (case ! scheduler of NONE => false | SOME thread => Thread.isActive thread);
   408 
   408 
   409 fun scheduler_check () = (*requires SYNCHRONIZED*)
   409 fun scheduler_check () = (*requires SYNCHRONIZED*)