
On Fri, 11 Jul 2003, Volker Stolz wrote:
createPipe :: IO (Fd,Fd) (Unkown alternatives)
I suppose you have to pass this descriptor to another process through fork()?
Rigth. (piper,pipew) <- createPipe mpid <- forkProcess case mpid of Nothing -> do --child nobytes <- fdWrite pipew stringToSend Just pid -> do --parent (string,nobytes) <- fdRead piper stringReceived maxBytes
There's System.Posix.IO.fdToHandle :: Fd -> IO Handle
What about ? threadReadWait :: Int -> IO() Should I convert a Handle into a Int ?
I suppose there is System.Posix.IO.handleToFd :: Handle -> IO (Fd) and then ... (piper,pipew) <- createPipe piperHandle <- fdToHandle(piper) threadWaitRead ( fdToInt(handleToFd(piperHandle)) ) message <- hGetLine piperHandle --or whatever. ...
Yes, that should work, too, but you won't know how many bytes are available. You could use or adapt one of the *MayBlock-ellipses from Foreign.C.Error together with threadWaitRead, but that's making things even more ugly.
Volker
OK. Don't worry. Thank you very much. Very usefull.