blob: e2841df58226b26e8a0b5a00dce3a7a98f1cd64c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
** $Id$
\* */
package scala;
/** This trait can be used to mix in functionality for synchronizing
* threads on this object.
*
* @author Martin Odersky
* @version 1.0, 11/07/2003
*/
trait Monitor {
def synchronized[a](def p: a): a =
scala.runtime.NativeMonitor.synchronised(this, p);
def await(def cond: Boolean) = while (!cond) { this.wait() }
}
|