merged
authorwenzelm
Tue Jan 05 13:41:29 2016 +0100 (2016-01-05)
changeset 62057af58628952f0
parent 62055 755fda743c49
parent 62056 6dbeafce6318
child 62058 1cfd5d604937
merged
     1.1 --- a/src/Pure/Concurrent/standard_thread.scala	Tue Jan 05 13:35:06 2016 +0100
     1.2 +++ b/src/Pure/Concurrent/standard_thread.scala	Tue Jan 05 13:41:29 2016 +0100
     1.3 @@ -9,7 +9,7 @@
     1.4  
     1.5  
     1.6  import java.lang.Thread
     1.7 -import java.util.concurrent.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue}
     1.8 +import java.util.concurrent.{ThreadPoolExecutor, TimeUnit, LinkedBlockingQueue, ThreadFactory}
     1.9  
    1.10  import scala.concurrent.{ExecutionContext, ExecutionContextExecutor}
    1.11  
    1.12 @@ -35,7 +35,19 @@
    1.13      {
    1.14        val m = Properties.Value.Int.unapply(System.getProperty("isabelle.threads", "0")) getOrElse 0
    1.15        val n = if (m > 0) m else (Runtime.getRuntime.availableProcessors max 1) min 8
    1.16 -      new ThreadPoolExecutor(n, n, 2500L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable])
    1.17 +      val executor =
    1.18 +        new ThreadPoolExecutor(n, n, 2500L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue[Runnable])
    1.19 +      val old_thread_factory = executor.getThreadFactory
    1.20 +      executor.setThreadFactory(
    1.21 +        new ThreadFactory {
    1.22 +          def newThread(r: Runnable) =
    1.23 +          {
    1.24 +            val thread = old_thread_factory.newThread(r)
    1.25 +            thread.setDaemon(true)
    1.26 +            thread
    1.27 +          }
    1.28 +        })
    1.29 +      executor
    1.30      }
    1.31  
    1.32    lazy val execution_context: ExecutionContextExecutor =