[Haskell-cafe] POSIX AIO (asych I/O) ...

Galchin, Vasili vigalchin at gmail.com
Tue Jul 1 03:42:26 EDT 2008


       I am also testing my aio support. The aio_write binding seems to work
ok .. as well as aio_error, Aio_return is a problem child. I think I wrote a
really simple binding. I always receive nbytes as 0. I have been staring at
the code hoping to catch a stupid mistake. I put putStrLn's in the code.
.....Here is the code ...

aioReturn :: AIOCB -> IO (AIOCB, ByteCount)
aioReturn aiocb = do
   allocaBytes (#const sizeof(struct aiocb)) $ \ p_aiocb -> do
      poke p_aiocb aiocb
      count <- throwErrnoIfMinus1 "aioReturn" (c_aio_return  p_aiocb)
      aiocb <- peek p_aiocb
      return (aiocb, fromIntegral count)

foreign import ccall safe "aio.h aio_return"
    c_aio_return :: Ptr AIOCB -> IO CInt

Maybe someone can spot something that I haven't.

Thanks, Vasili
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080701/4fbec950/attachment.htm

More information about the Haskell-Cafe mailing list