When an Isabelle instance has been created (using System.create), several threads are started for communicating with Isabelle. These are all non-daemon threads. This means that when the main program ends, the JVM does not return but waits indefinitely.
The following snippets shows the threads that keep the JVM from exiting:
import scala.collection.JavaConverters._
val threadSet = Thread.getAllStackTraces.keySet.asScala
for (t <- threadSet if !t.isDaemon)
println(t.getName)
The output is:
standard_error
standard_output
process_manager
command_input
message_output
process_result
main
Only main should be a non-daemon thread.
(Of course, one can always exit via sys.exit, but that puts the burden on the developer to make sure all possible execution paths end with sys.exit.)
When an Isabelle instance has been created (using System.create), several threads are started for communicating with Isabelle. These are all non-daemon threads. This means that when the main program ends, the JVM does not return but waits indefinitely.
The following snippets shows the threads that keep the JVM from exiting:
The output is:
Only
mainshould be a non-daemon thread.(Of course, one can always exit via
sys.exit, but that puts the burden on the developer to make sure all possible execution paths end withsys.exit.)