# HG changeset patch # User Daichi TOMA # Date 1390371816 -32400 # Node ID 72cc49b616cd34278aa3be28730499429d83eeec # Parent 3337ccc824a44ebc636e9618b29a7f40af1b0a7a print in rpar diff -r 3337ccc824a4 -r 72cc49b616cd test/ParWrite.hs --- a/test/ParWrite.hs Wed Jan 22 15:13:10 2014 +0900 +++ b/test/ParWrite.hs Wed Jan 22 15:23:36 2014 +0900 @@ -46,21 +46,20 @@ printTimeSince t0 sequence_ $ runEval $ dualWrite jungle - tree1 <- getRootNode jungle treeId - tree2 <- getRootNode jungle treeId2 - - print $ fromJust (getAttributes tree1 lastPos (show (writeCount-1))) - print $ fromJust (getAttributes tree2 lastPos (show (writeCount-1))) printTimeSince t0 -- parallel write for two trees by singleWrite dualWrite jungle = do - x <- rpar (updateRootNodeWith (writeFunctions writeCount) jungle treeId) - y <- rseq (updateRootNodeWith (writeFunctions writeCount) jungle treeId2) - rseq x + x <- rpar (test jungle treeId) + y <- rpar (test jungle treeId2) return [x, y] +test jungle id = do + updateRootNodeWith (writeFunctions writeCount) jungle id + tree <- getRootNode jungle id + print $ fromJust (getAttributes tree lastPos (show (writeCount-1))) + -- generate functions to node update writeFunctions :: Int -> Node -> Node writeFunctions writeCount node = foldl' apply node [0..writeCount]