summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-08-07 13:33:30 +0000
committerpaltherr <paltherr@epfl.ch>2003-08-07 13:33:30 +0000
commit3db90fcd88868e743a0c8d3e06b2d8a55368f108 (patch)
tree8b01259a7e2b2fc3bd41739163d8d036e0ace075 /sources
parent62ea09a68046a6b6f98dc8c12cb3a6ab113ab141 (diff)
downloadscala-3db90fcd88868e743a0c8d3e06b2d8a55368f108.tar.gz
scala-3db90fcd88868e743a0c8d3e06b2d8a55368f108.tar.bz2
scala-3db90fcd88868e743a0c8d3e06b2d8a55368f108.zip
- fixed to pass compilation
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/concurrent/Channel.scala10
-rw-r--r--sources/scala/concurrent/MailBox.scala21
2 files changed, 21 insertions, 10 deletions
diff --git a/sources/scala/concurrent/Channel.scala b/sources/scala/concurrent/Channel.scala
index 0ebc751081..cc9a6a4ce4 100644
--- a/sources/scala/concurrent/Channel.scala
+++ b/sources/scala/concurrent/Channel.scala
@@ -1,12 +1,16 @@
package scala.concurrent;
-class Channel[a] with Monitor {
- private var written: LinkedList[a] = new LinkedList;
+import scala.collection.mutable.LinkedList;
+
+class Channel[a <: AnyRef] with Monitor {
+ // !!! is this new correct ?
+ private var written = new LinkedList[a](null, null);
private var lastWritten = written;
private var nreaders = 0;
def write(x: a) = synchronized {
- lastWritten.next = new LinkedList;
+ // !!! is this new correct ?
+ lastWritten.next = new LinkedList(x, null);
lastWritten = lastWritten.next;
if (nreaders > 0) notify();
}
diff --git a/sources/scala/concurrent/MailBox.scala b/sources/scala/concurrent/MailBox.scala
index fb50b515c9..e83829acbc 100644
--- a/sources/scala/concurrent/MailBox.scala
+++ b/sources/scala/concurrent/MailBox.scala
@@ -1,5 +1,7 @@
package scala.concurrent;
+import scala.collection.mutable.LinkedList;
+
class MailBox with Monitor {
type Message = AnyRef;
@@ -18,20 +20,24 @@ class MailBox with Monitor {
}
}
- private val sent = new LinkedList[Message];
+ // !!! is this new correct ?
+ private val sent = new LinkedList[Message](null, null);
private var lastSent = sent;
- private var receivers = new LinkedList[Receiver];
+ // !!! is this new correct ?
+ private var receivers = new LinkedList[Receiver](null, null);
private var lastReceiver = receivers;
def send(msg: Message): Unit = synchronized {
var rs = receivers, rs1 = rs.next;
- while (rs1 != null && !rs1.elem.receiver.isDefinedAt(msg)) {
- rs = rs1; rs1 = rs1.next;
- }
+ // !!! does not compile
+ // !!! while (rs1 != null && !rs1.elem.receiver.isDefinedAt(msg)) {
+ // !!! rs = rs1; rs1 = rs1.next;
+ // !!! }
if (rs1 != null) {
rs.next = rs1.next; rs1.elem.msg = msg; rs1.elem.notify();
} else {
- lastSent = lastSent.append(msg)
+ // !!! does not compile
+ // !!! lastSent = lastSent.append(msg)
}
}
@@ -43,7 +49,8 @@ class MailBox with Monitor {
if (ss1 != null) {
ss.next = ss1.next; r.msg = ss1.elem;
} else {
- lastReceiver = lastReceiver append r;
+ // !!! does not compile
+ // !!! lastReceiver = lastReceiver append r;
}
}