/**
* Module containing basic classes and functions for concurrency.
*/
module concurrency with {
  
  abstract class Spawn with {
    def <(def p: Unit): Spawn;
    def |(def p: Unit): Spawn;
    def > : Unit;
  }
  val spawn = new Spawn with {
    def <(def p: Unit): Spawn = { fork(p); this }
    def |(def p: Unit): Spawn = { fork(p); this }
    def > : Unit = ()
  }
  
  /**
  * Makes the current thread waiting for a while.
  */
  def sleep(timeout: Long): Unit = {
    val m = new Monitor;
    m synchronized {
      m.wait(timeout);
    }
  }

}


