summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/IO/countReaders001.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/IO/countReaders001.hs')
-rw-r--r--testsuite/tests/lib/IO/countReaders001.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/testsuite/tests/lib/IO/countReaders001.hs b/testsuite/tests/lib/IO/countReaders001.hs
new file mode 100644
index 0000000000..2648ae77ae
--- /dev/null
+++ b/testsuite/tests/lib/IO/countReaders001.hs
@@ -0,0 +1,17 @@
+-- test for trac #629. We need to keep track of how many readers
+-- there are rather than closing the first read handle causing the
+-- lock to be released.
+
+import System.IO
+import System.IO.Error
+
+file = "countReaders001.txt"
+
+main = do
+ writeFile file "foo"
+
+ h1 <- openFile file ReadMode
+ h2 <- openFile file ReadMode
+ hClose h1
+ tryIOError (openFile file AppendMode) >>= print
+