src/Pure/Thy/thy_resources.scala
changeset 68981 30daac7848b9
parent 68962 50676b0ab970
child 68986 22f02724e7d1
equal deleted inserted replaced
68979:e2244e5707dd 68981:30daac7848b9
    78       (nodes.iterator ++ nodes_committed.iterator).forall({ case (_, st) => st.ok })
    78       (nodes.iterator ++ nodes_committed.iterator).forall({ case (_, st) => st.ok })
    79   }
    79   }
    80 
    80 
    81   val default_check_delay = Time.seconds(0.5)
    81   val default_check_delay = Time.seconds(0.5)
    82   val default_nodes_status_delay = Time.seconds(-1.0)
    82   val default_nodes_status_delay = Time.seconds(-1.0)
    83   val default_commit_clean_delay = Time.seconds(60.0)
    83   val default_commit_cleanup_delay = Time.seconds(60.0)
    84   val default_watchdog_timeout = Time.seconds(600.0)
    84   val default_watchdog_timeout = Time.seconds(600.0)
    85 
    85 
    86 
    86 
    87   class Session private[Thy_Resources](
    87   class Session private[Thy_Resources](
    88     session_name: String,
    88     session_name: String,
   190       watchdog_timeout: Time = default_watchdog_timeout,
   190       watchdog_timeout: Time = default_watchdog_timeout,
   191       nodes_status_delay: Time = default_nodes_status_delay,
   191       nodes_status_delay: Time = default_nodes_status_delay,
   192       id: UUID = UUID(),
   192       id: UUID = UUID(),
   193       // commit: must not block, must not fail
   193       // commit: must not block, must not fail
   194       commit: Option[(Document.Snapshot, Document_Status.Node_Status) => Unit] = None,
   194       commit: Option[(Document.Snapshot, Document_Status.Node_Status) => Unit] = None,
   195       commit_clean_delay: Time = default_commit_clean_delay,
   195       commit_cleanup_delay: Time = default_commit_cleanup_delay,
   196       progress: Progress = No_Progress): Theories_Result =
   196       progress: Progress = No_Progress): Theories_Result =
   197     {
   197     {
   198       val dep_theories =
   198       val dep_theories =
   199       {
   199       {
   200         val import_names =
   200         val import_names =
   235           Standard_Thread.delay_first(nodes_status_delay max Time.zero) {
   235           Standard_Thread.delay_first(nodes_status_delay max Time.zero) {
   236             progress.nodes_status(use_theories_state.value.nodes_status)
   236             progress.nodes_status(use_theories_state.value.nodes_status)
   237           }
   237           }
   238 
   238 
   239         val delay_commit_clean =
   239         val delay_commit_clean =
   240           Standard_Thread.delay_first(commit_clean_delay max Time.zero) {
   240           Standard_Thread.delay_first(commit_cleanup_delay max Time.zero) {
   241             val clean = use_theories_state.value.already_committed.keySet
   241             val clean = use_theories_state.value.already_committed.keySet
   242             resources.clean_theories(session, id, clean)
   242             resources.clean_theories(session, id, clean)
   243           }
   243           }
   244 
   244 
   245         val dep_theories_set = dep_theories.toSet
   245         val dep_theories_set = dep_theories.toSet
   279 
   279 
   280               theory_progress.foreach(progress.theory(_))
   280               theory_progress.foreach(progress.theory(_))
   281 
   281 
   282               check_result()
   282               check_result()
   283 
   283 
   284               if (commit.isDefined && commit_clean_delay > Time.zero) {
   284               if (commit.isDefined && commit_cleanup_delay > Time.zero) {
   285                 if (use_theories_state.value.finished_result)
   285                 if (use_theories_state.value.finished_result)
   286                   delay_commit_clean.revoke
   286                   delay_commit_clean.revoke
   287                 else delay_commit_clean.invoke
   287                 else delay_commit_clean.invoke
   288               }
   288               }
   289             }
   289             }