From 8ab76d2240cd421a77474b9b87046334f35301f2 Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 5 Feb 2018 19:48:31 +0000 Subject: [PATCH] Remove unnecessary test file --- test/chantest.hs | 51 ------------------------------------------------ 1 file changed, 51 deletions(-) delete mode 100644 test/chantest.hs diff --git a/test/chantest.hs b/test/chantest.hs deleted file mode 100644 index 376062f..0000000 --- a/test/chantest.hs +++ /dev/null @@ -1,51 +0,0 @@ -import Control.Concurrent -import qualified EuphApi.CloseableChan as E - -thread1 c n = do - E.writeChan c n - thread1 c (n + 1) - -thread2 c = do - val <- E.readChan c - case val of - Just j -> (print j) >> thread2 c - Nothing -> putStrLn "thread2 closed!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" - -main1 = do - c <- E.newOpenChan - t1 <- forkIO $ thread1 c 0 - t2 <- forkIO $ thread2 c - threadDelay $ 500*1000 - E.closeChan c - threadDelay $ 500*1000 - -main2 = do - c <- E.newOpenChan - forkIO $ thread2 c - putStrLn "Go!" - - mapM_ (E.writeChan c) [1..5] - -- putStrLn "added some numbers" - - threadDelay $ 1000*1000 - putStrLn "first second" - threadDelay $ 1000*1000 - putStrLn "second second" - - mapM_ (E.writeChan c) [6..10] - -- putStrLn "added more numbers" - - threadDelay $ 1000*1000 - putStrLn "third second" - threadDelay $ 1000*1000 - putStrLn "fourth second" - - E.closeChan c - -- putStrLn "channel closed" - - threadDelay $ 1000*1000 - putStrLn "fifth second" - threadDelay $ 1000*1000 - putStrLn "sixth second" - -main = main2