summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2008-04-06 21:23:16 +0000
committerBurak Emir <emir@epfl.ch>2008-04-06 21:23:16 +0000
commit4fa39e5246c19cd32be3f03a96649778d6a0a2db (patch)
tree56ff9540e76c0315daaded76e0100457b86b22a0 /src
parentf64174df68cde2f2d0079249c08292c5fb02adbf (diff)
downloadscala-4fa39e5246c19cd32be3f03a96649778d6a0a2db.tar.gz
scala-4fa39e5246c19cd32be3f03a96649778d6a0a2db.tar.bz2
scala-4fa39e5246c19cd32be3f03a96649778d6a0a2db.zip
'busy waiting? you're not serious' said the Thr...
'busy waiting? you're not serious' said the Thread and went to sleep(1).
Diffstat (limited to 'src')
-rw-r--r--src/library/jvm/scala/io/BufferedSource.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/library/jvm/scala/io/BufferedSource.scala b/src/library/jvm/scala/io/BufferedSource.scala
index 5c49855ed4..99d8d036ae 100644
--- a/src/library/jvm/scala/io/BufferedSource.scala
+++ b/src/library/jvm/scala/io/BufferedSource.scala
@@ -59,9 +59,11 @@ abstract class BufferedSource(byteChannel: ReadableByteChannel, decoder: Charset
def fillBuffer() = {
byteBuffer.compact()
charBuffer.position(0)
- int num_bytes = 0;
- while (0 == num_bytes)
+ var num_bytes = byteChannel.read(byteBuffer)
+ while (0 == num_bytes) {
+ Thread.sleep(1); // wait 1 ms for new data
num_bytes = byteChannel.read(byteBuffer)
+ }
num_bytes match {
case -1 =>
endOfInput = true;