"Fossies" - the Fresh Open Source Software Archive

Member "scala-js-1.3.1/scalalib/overrides-2.11/scala/concurrent/impl/AbstractPromise.scala" (14 Nov 2020, 607 Bytes) of package /linux/www/scala-js-1.3.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Scala source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 package scala.concurrent.impl
    2 
    3 /**
    4  * JavaScript specific implementation of AbstractPromise
    5  *
    6  * This basically implements a "CAS" in Scala for JavaScript. Its
    7  * implementation is trivial because there is no multi-threading.
    8  *
    9  * @author Tobias Schlatter
   10  */
   11 abstract class AbstractPromise {
   12 
   13   private var state: AnyRef = _
   14 
   15   protected final
   16   def updateState(oldState: AnyRef, newState: AnyRef): Boolean = {
   17     if (state eq oldState) {
   18       state = newState
   19       true
   20     } else false
   21   }
   22 
   23   protected final def getState: AnyRef = state
   24 
   25 }
   26 
   27 object AbstractPromise {
   28   protected def updater = ???
   29 }