summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorcremet <cremet@epfl.ch>2003-10-22 08:43:20 +0000
committercremet <cremet@epfl.ch>2003-10-22 08:43:20 +0000
commit3b888fff88f0402dcdd355c37cfc6309743a7236 (patch)
tree93becbfa06c589215ed6c453627a0835a8181e80 /sources
parent98f8b715ca0646cff57e083f69a7c30c1439ae75 (diff)
downloadscala-3b888fff88f0402dcdd355c37cfc6309743a7236.tar.gz
scala-3b888fff88f0402dcdd355c37cfc6309743a7236.tar.bz2
scala-3b888fff88f0402dcdd355c37cfc6309743a7236.zip
*** empty log message ***
Diffstat (limited to 'sources')
-rw-r--r--sources/examples/jolib/Ref.scala11
-rw-r--r--sources/examples/jolib/parallelOr.scala11
-rw-r--r--sources/scala/concurrent/jolib.scala16
3 files changed, 25 insertions, 13 deletions
diff --git a/sources/examples/jolib/Ref.scala b/sources/examples/jolib/Ref.scala
index d48a9ee8f3..149f83efe8 100644
--- a/sources/examples/jolib/Ref.scala
+++ b/sources/examples/jolib/Ref.scala
@@ -1,3 +1,14 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+** $Id$
+\* */
+
+package examples.jolib;
+
import concurrent.SyncVar;
import concurrent.jolib._;
diff --git a/sources/examples/jolib/parallelOr.scala b/sources/examples/jolib/parallelOr.scala
index 257733c855..620cf28212 100644
--- a/sources/examples/jolib/parallelOr.scala
+++ b/sources/examples/jolib/parallelOr.scala
@@ -1,3 +1,14 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+** $Id$
+\* */
+
+package examples.jolib;
+
import concurrent.jolib._;
import concurrent.SyncVar;
diff --git a/sources/scala/concurrent/jolib.scala b/sources/scala/concurrent/jolib.scala
index c02f2071ae..38623df370 100644
--- a/sources/scala/concurrent/jolib.scala
+++ b/sources/scala/concurrent/jolib.scala
@@ -14,22 +14,12 @@ package scala.concurrent;
*/
object jolib {
- /////////////////// QUEUE /////////////////////////
-
- class Queue[a] {
- private var queue: List[a] = Nil;
- def enqueue(x: a) = queue = queue ::: List(x);
- def dequeue: a = { val x = queue.head; queue = queue.tail; x };
- def front: a = queue.head;
- def isEmpty = queue.isEmpty;
- }
-
- /////////////////// JOIN /////////////////////////
-
type Pattern = List[Signal];
type Rule = PartialFunction[List[Any], unit];
+ /////////////////// JOIN DEFINITION /////////////////////////
+
class Join with Monitor {
private var ruls: List[Pair[Pattern, Rule]] = null;
@@ -58,7 +48,7 @@ object jolib {
abstract class Signal (join: Join) {
type C;
- val queue = new Queue[C];
+ val queue = new collection.mutable.Queue[C];
def tryReduction(x: C): unit = {
val continuation = join synchronized {
queue.enqueue(x);