[Haskell-cafe] carry "state" around ....

Galchin, Vasili vigalchin at gmail.com
Sun Jul 20 00:55:44 EDT 2008


yes Duncan I am trying to pass-by-value. I am familiar with ForeignPtr;
however, I don't comprehend what you and Brandon are suggesting to do. Could
either of you provide a code illustration or point at existing code to
illustrate your approach?

Kind regards, Vasili

On Sat, Jul 19, 2008 at 8:28 AM, Duncan Coutts <duncan.coutts at worc.ox.ac.uk>
wrote:

>
> On Sat, 2008-07-19 at 01:40 -0500, Galchin, Vasili wrote:
> > hello,
> >
> >
> >     Following is more of a criticism of Linux implementation of the
> > Posix real-time extension of asynchronous I/O.... if not interesting
> > please skip. The central data structure for Posix AIO is an aiocb. In
> > any case, the Linux implementors added to the aiocb:
>
> [..]
>
> > My viewpoint is that the above "Internal members" must be "carried"
> > around in a Haskell program. Am I correct?? If I am correct, then the
> > Linux implementation of Posix AIO is not portable to say Solaris? In
> > hindsight, if I am correct, it seems that the Linux implementation of
> > AIO should use the ordered pair (pid, fd) to reference the "internal"
> > members and leave the "aiocb" "clean"?
>
> Although it is different between platforms it is still portable. When
> you allocate memory in C for the aiocb struct you would use
> sizeof(aiocb). That's portable even if the size is different on Linux vs
> Solaris. Then members are only accessed by name which is again portable.
>
> Your problem perhaps is that you're trying to convert an aiocb into a
> pure haskell version and convert it back and expect to retain all the
> information. I think that is a mistake. Don't pass the aiocb's by value,
> pass them by reference. Use a ForeignPtr and just access the members you
> need whenever you need them.
>
> Duncan
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080719/fb929fe7/attachment.htm


More information about the Haskell-Cafe mailing list