From 492f5f52141ecd71f2decdbf7eda7aed51dfb64c Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Thu, 14 Oct 2010 05:10:25 +0000 Subject: Fixing issue with XMLEventReader.stop failing t... Fixing issue with XMLEventReader.stop failing to stop the parser thread. Contributed by Jean-Laurent Huynh, reviewed by extempore. Closes #3881. --- test/files/run/bug3881.check | 1 + test/files/run/bug3881.scala | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 test/files/run/bug3881.check create mode 100644 test/files/run/bug3881.scala (limited to 'test') diff --git a/test/files/run/bug3881.check b/test/files/run/bug3881.check new file mode 100644 index 0000000000..888acde74f --- /dev/null +++ b/test/files/run/bug3881.check @@ -0,0 +1 @@ +1000000 xml events diff --git a/test/files/run/bug3881.scala b/test/files/run/bug3881.scala new file mode 100644 index 0000000000..21247492f5 --- /dev/null +++ b/test/files/run/bug3881.scala @@ -0,0 +1,27 @@ +object Test { + + def forever() = new io.Source { + val iter = "".iterator ++ new Iterator[Char] { + var count = -1 + val bar = "\n" + def hasNext = true + def next() = { + count += 1 + bar(count % bar.length) + } + } + } + + def main(args: Array[String]): Unit = { + val src = forever() + val reader = new xml.pull.XMLEventReader(src) + var count = 0 + while (reader.hasNext && count < 1000000) { + reader.next + count += 1 + } + reader.stop + println(count + " xml events") + } +} + -- cgit v1.2.3