src/Pure/Concurrent/isabelle_thread.scala
changeset 79603 9f002cdb6b8d
parent 78838 4b014e6c1dfe
child 79716 f33d37c171a9
equal deleted inserted replaced
79602:9ba800f12785 79603:9f002cdb6b8d
    70   }
    70   }
    71 
    71 
    72 
    72 
    73   /* thread pool */
    73   /* thread pool */
    74 
    74 
    75   def max_threads(): Int = {
       
    76     val m = Value.Int.unapply(System.getProperty("isabelle.threads", "0")) getOrElse 0
       
    77     if (m > 0) m else (Host.num_cpus() max 1) min 8
       
    78   }
       
    79 
       
    80   lazy val pool: ThreadPoolExecutor = {
    75   lazy val pool: ThreadPoolExecutor = {
    81     val n = max_threads()
    76     val n = Multithreading.max_threads()
    82     val executor =
    77     val executor =
    83       new ThreadPoolExecutor(n, n, 2500L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable])
    78       new ThreadPoolExecutor(n, n, 2500L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable])
    84     executor.setThreadFactory(
    79     executor.setThreadFactory(
    85       create(_, name = make_name(base = "worker"), group = worker_thread_group))
    80       create(_, name = make_name(base = "worker"), group = worker_thread_group))
    86     executor
    81     executor