From b870b4d3c9918372ab3eb376b20be1e54c8a0985 Mon Sep 17 00:00:00 2001 From: cremet Date: Tue, 30 Sep 2003 14:20:02 +0000 Subject: - Minor simplification. --- sources/scala/concurrent/pilib.scala | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'sources') diff --git a/sources/scala/concurrent/pilib.scala b/sources/scala/concurrent/pilib.scala index c3cf55bd2d..19fc336a18 100644 --- a/sources/scala/concurrent/pilib.scala +++ b/sources/scala/concurrent/pilib.scala @@ -80,9 +80,7 @@ object pilib with Monitor { case class Sum(gs: List[GP]) with Monitor { /** Continuation of the sum. */ - var fun: Any => unit = _; - /** Argument of the continuation of the sum. */ - var arg: Any = _; + var cont: () => unit = _; var initialized = false; @@ -92,13 +90,12 @@ object pilib with Monitor { */ def continue = synchronized { if (!initialized) wait(); - fun(arg) + cont() } /** Set the values of parameters and awake the sleeping sum. */ - def set(f: Any => unit, x: Any) = synchronized { - fun = f; - arg = x; + def set(f: () => unit) = synchronized { + cont = f; initialized = true; notify() } @@ -134,8 +131,8 @@ object pilib with Monitor { case s2 :: rest => matches(s1.gs, s2.gs) match { case None => s2 :: compare(s1, rest) case Some(Tuple4(v1, c1, v2, c2)) => { - s1.set(c1, v2); - s2.set(c2, v1); + s1.set(() => c1(v2)); + s2.set(() => c2(v1)); rest } } -- cgit v1.2.3