
28 Oct
2013
28 Oct
'13
1:16 p.m.
Sorry, I've sent the wrong snippet. This is the correct one: main = do let lock = (WriteLock, AbsoluteSeek, 0, 0) fd <- openFd "/tmp/foobar" ReadWrite (Just stdFileMode) defaultFileFlags {trunc=True} pid1 <- forkProcess $ do setLock fd lock >> putStrLn "child: locked!" executeFile "/usr/bin/sleep" False ["5"] Nothing pid2 <- forkProcess $ do setLock fd lock >> putStrLn "parent: locked!" executeFile "/usr/bin/sleep" False ["5"] Nothing threadDelay $ 1 * 1000 * 1000 mapM_ (getProcessStatus True False) [pid1, pid2] ~dsouza