Marcin 'Qrczak' Kowalczyk wrote:

>"fileRead :: File -> FileOffset -> Integer -> Buffer -> IO ()"
>
>This is unimplementable safely if the descriptor is read concurrently
>by different processes. The current position is shared.

... which is terrible library design, which we should avoid if at all possible, which is one of several reasons that I want to get rid of the notion of "current position". Hence the above prototype.

fileRead can be implemented in terms of OS primitives, and it's easy enough to implement a thread-safe seek/read interface on top of it. The reverse isn't true--if we provided seek/read, it would be very hard to implement fileRead safely. (Maybe that's what you were saying?)

-- Ben

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to