src/Pure/PIDE/session.scala
changeset 69640 af09cc4792dc
parent 69492 b4b4d3ec55b3
child 70284 3e17c3a5fd39
     1.1 --- a/src/Pure/PIDE/session.scala	Sat Jan 12 19:53:57 2019 +0100
     1.2 +++ b/src/Pure/PIDE/session.scala	Sat Jan 12 20:14:05 2019 +0100
     1.3 @@ -9,6 +9,7 @@
     1.4  
     1.5  
     1.6  import scala.collection.immutable.Queue
     1.7 +import scala.annotation.tailrec
     1.8  
     1.9  
    1.10  object Session
    1.11 @@ -640,6 +641,16 @@
    1.12        pending_edits: List[Text.Edit] = Nil): Document.Snapshot =
    1.13      global_state.value.snapshot(name, pending_edits)
    1.14  
    1.15 +  @tailrec final def await_stable_snapshot(): Document.Snapshot =
    1.16 +  {
    1.17 +    val snapshot = this.snapshot()
    1.18 +    if (snapshot.is_outdated) {
    1.19 +      Thread.sleep(output_delay.ms)
    1.20 +      await_stable_snapshot()
    1.21 +    }
    1.22 +    else snapshot
    1.23 +  }
    1.24 +
    1.25    def start(start_prover: Prover.Receiver => Prover)
    1.26    {
    1.27      file_formats