diff options
author | cremet <cremet@epfl.ch> | 2003-09-30 14:20:02 +0000 |
---|---|---|
committer | cremet <cremet@epfl.ch> | 2003-09-30 14:20:02 +0000 |
commit | b870b4d3c9918372ab3eb376b20be1e54c8a0985 (patch) | |
tree | 567d140e7d9a27e933970dc44a2500a307d70df0 | |
parent | 0ff59624efa4b23fc9052a4367308718a4087f6a (diff) | |
download | scala-b870b4d3c9918372ab3eb376b20be1e54c8a0985.tar.gz scala-b870b4d3c9918372ab3eb376b20be1e54c8a0985.tar.bz2 scala-b870b4d3c9918372ab3eb376b20be1e54c8a0985.zip |
- Minor simplification.
-rw-r--r-- | sources/scala/concurrent/pilib.scala | 15 |
1 files changed, 6 insertions, 9 deletions
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 } } |