From 643a9f3e2ca7fa5f9634d1723a1f546e4df836cc Mon Sep 17 00:00:00 2001 From: paltherr Date: Mon, 19 Jan 2004 15:52:05 +0000 Subject: - Removed usage of Monitor --- sources/examples/boundedbuffer.scala | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/examples/boundedbuffer.scala b/sources/examples/boundedbuffer.scala index fdc6feb9b4..06ecec9d9a 100644 --- a/sources/examples/boundedbuffer.scala +++ b/sources/examples/boundedbuffer.scala @@ -4,10 +4,12 @@ object boundedbuffer { import concurrent.ops._; - class BoundedBuffer[a](N: Int) extends Monitor() { + class BoundedBuffer[a](N: Int) { var in = 0, out = 0, n = 0; val elems = new Array[a](N); + def await(def cond: Boolean) = while (!cond) { wait() } + def put(x: a) = synchronized { await (n < N); elems(in) = x; in = (in + 1) % N; n = n + 1; -- cgit v1.2.3