On Tue, 5 Aug 2003, Seth Kurtzberg wrote:
> For my purposes (transaction logging for my database server) I need to
> be able to guarantee that data is written to disk. That is, it isn't
> enough to disable buffering in the compiler libraries (all libraries,
> more accurately), I need to also force the O/S to flush the data to
> disk.
>> This is difficult to do in a portable manner, obviously, but if a
> practical way can be found it would have many uses in systems using
> transactional semantics. It would also get rid of an FFI dependency
> for my code.
My intended semantics for the osFlush function was always that it would do
its best to ensure that the data was "pushed as far as possible" toward
its final destination.
If you need a guarantee, the function could be made to return a Bool, with
True indicating that it was absolutely sure that the data had made it all
the way. But I don't think that it could ever return True. It might be
running in a VMware sandbox without realizing it, for example. So you'll
probably have to run tests on your particular setup to see how well it
works.
-- Ben