Created
February 2, 2013 16:32
-
-
Save wavewave/4698146 to your computer and use it in GitHub Desktop.
named pipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Control.Concurrent | |
| import Control.Monad | |
| import Control.Monad.Loops | |
| import System.IO | |
| import System.Posix.Files | |
| main = do | |
| -- createNamedPipe "/tmp/test.fifo" $ unionFileModes ownerReadMode ownerWriteMode | |
| -- forever (hGetLine pipe >>= putStrLn) | |
| pipestr <- iterateUntil (not.null) $ do | |
| putStrLn "reading pipe" | |
| threadDelay 5000000 | |
| readFile "/tmp/test.fifo" -- ReadMode | |
| putStrLn pipestr | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment