[Haskell-cafe] POSIX AIO (asych I/O) ...
bulat.ziganshin at gmail.com
Tue Jul 1 03:48:14 EDT 2008
Tuesday, July 1, 2008, 11:42:26 AM, you wrote:
looks ok, show us your peek/poke code
> 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
Bulat mailto:Bulat.Ziganshin at gmail.com
More information about the Haskell-Cafe