summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/prog002
diff options
context:
space:
mode:
authorThomas Miedema <thomasmiedema@gmail.com>2016-06-18 22:44:19 +0200
committerThomas Miedema <thomasmiedema@gmail.com>2016-06-20 16:22:07 +0200
commit5b03dc69389dc387b922c589ab9a8b92079e6a96 (patch)
tree807db4d3e26cc078cab86def2df40afcd59803db /testsuite/tests/concurrent/prog002
parent915e07c33b143126e3c8de1d2ec22ccc709a9a24 (diff)
downloadhaskell-5b03dc69389dc387b922c589ab9a8b92079e6a96.tar.gz
Testsuite: tabs -> spaces [skip ci]
Diffstat (limited to 'testsuite/tests/concurrent/prog002')
-rw-r--r--testsuite/tests/concurrent/prog002/Scheduler.hs30
-rw-r--r--testsuite/tests/concurrent/prog002/Server.hs8
2 files changed, 19 insertions, 19 deletions
diff --git a/testsuite/tests/concurrent/prog002/Scheduler.hs b/testsuite/tests/concurrent/prog002/Scheduler.hs
index bbfd374c43..0b9cf5bdd8 100644
--- a/testsuite/tests/concurrent/prog002/Scheduler.hs
+++ b/testsuite/tests/concurrent/prog002/Scheduler.hs
@@ -1,10 +1,10 @@
-module Scheduler
+module Scheduler
( runTIO
, module Event
, module Thread
, TTree
, TIO
-)
+)
where
import Event
@@ -18,14 +18,14 @@ type TIO = ContM SysReq SysRsp IO
runTIO :: [TIO ()] -> IO ()
-runTIO l = runThreads $ map buildThread l
+runTIO l = runThreads $ map buildThread l
-data World = World
+data World = World
{ mReadyQ :: ! (Chan (TTree)) }
max_steps = 1
-worker_pure world=
- do
+worker_pure world=
+ do
t <- readChan readyq
case t of
(Atom _) -> return ()
@@ -38,26 +38,26 @@ worker_pure world=
exec_thread 0 t =
do putStr "."; hFlush stdout
writeChan readyq t
- exec_thread c (Atom mx) =
- do
+ exec_thread c (Atom mx) =
+ do
x <- mx
exec_thread (c-1) x
exec_thread c (Stop) = return ()
-
+
runThreads :: [TTree] -> IO ()
runThreads l =
- do
+ do
mready <- newChan
writeList2Chan mready l
- let world = World mready
+ let world = World mready
multiloop world
loop_p world = do worker_pure world; loop_p world
-multiloop world =
- do
- -- a mixture of bound threads & lightweight threads
- -- to make things interesting...
+multiloop world =
+ do
+ -- a mixture of bound threads & lightweight threads
+ -- to make things interesting...
forkOS (loop_p world)
forkOS (loop_p world)
forkOS (loop_p world)
diff --git a/testsuite/tests/concurrent/prog002/Server.hs b/testsuite/tests/concurrent/prog002/Server.hs
index 2ff1ccb8c8..ce338b7543 100644
--- a/testsuite/tests/concurrent/prog002/Server.hs
+++ b/testsuite/tests/concurrent/prog002/Server.hs
@@ -6,13 +6,13 @@ import Control.Concurrent
expensive = f (500 :: Int)
where f 0 = stop
- f n = do
+ f n = do
r <- atom $ getStdRandom (randomR (0,99::Int))
r `seq` f $! n-1
main = do
m <- newEmptyMVar
- forkIO (do
- runTIO $ map (\x->expensive) [1..500]
- putMVar m ())
+ forkIO (do
+ runTIO $ map (\x->expensive) [1..500]
+ putMVar m ())
takeMVar m