summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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;