src/Pure/Concurrent/multithreading.ML
changeset 79613 7a432595fb66
parent 79604 0e8ac7db1f4d
equal deleted inserted replaced
79612:8836386d6e3f 79613:7a432595fb66
    24 struct
    24 struct
    25 
    25 
    26 (* physical processors *)
    26 (* physical processors *)
    27 
    27 
    28 fun num_processors () =
    28 fun num_processors () =
    29   (case Thread.Thread.numPhysicalProcessors () of
    29   Int.max
    30     SOME n => n
    30     (case Thread.Thread.numPhysicalProcessors () of
    31   | NONE => Thread.Thread.numProcessors ());
    31       SOME n => n
       
    32     | NONE => Thread.Thread.numProcessors (), 1);
    32 
    33 
    33 
    34 
    34 (* max_threads *)
    35 (* max_threads *)
    35 
    36 
    36 local
    37 local
    37 
    38 
    38 fun max_threads_result m =
    39 fun max_threads_result m =
    39   if Thread_Data.is_virtual then 1
    40   if Thread_Data.is_virtual then 1
    40   else if m > 0 then m
    41   else if m > 0 then m
    41   else Int.min (Int.max (num_processors (), 1), 8);
    42   else Int.min (num_processors (), 8);
    42 
    43 
    43 val max_threads_state = ref 1;
    44 val max_threads_state = ref 1;
    44 
    45 
    45 in
    46 in
    46 
    47