Posix library ,Concurrent Haskell and Haskell IO sub-system
Volker Stolz
vs@foldr.org
Fri, 11 Jul 2003 09:51:52 +0200
On Fri, Jul 11, 2003 at 07:37:06AM +0200, Rafael Martinez Torres wrote:
> > Why do you "have to" use an Fd?
> >A regular handle should be sufficient.
> > Where do you get the Fd from?
>
> createPipe :: IO (Fd,Fd) (Unkown alternatives)
I suppose you have to pass this descriptor to another process
through fork()?
> > Did you consider lifting the Fd back
> > to a Handle?
>
> How ? Only known
> intToFd :: Int -> Fd
> fdToInt :: Fd -> Int
There's System.Posix.IO.fdToHandle :: Fd -> IO Handle
> What about ?
> threadReadWait :: Int -> IO()
> Should I convert a Handle into a Int ?
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
--
Volker Stolz * http://www-i2.informatik.rwth-aachen.de/stolz/ * PGP * S/MIME