Closing a dets

Hans Bolinder hasse@REDACTED
Wed Mar 23 13:43:06 CET 2005

[Tobias Lindahl:]
> Is there a way of waiting for a dets to be properly closed after
> dets:close/1 has been called. The problem is that I want to shut down the
> erlang node with an exit status (using halt(ExitStatus)), but wait until
> the dets is properly closed.

You should call dets:sync/1 before calling dets:close/1 if you want to
be sure that data have been written to disk (dets:sync/1 calls
file:sync/1 which calls fsync(3C)). (This may take some time if you
close many Dets tables.)

But I assume what you want is to be sure that no Dets table will need
to be repaired when opened next time. For that it should suffice to 
call dets:close/1 without calling dets:sync/1.

Or have you found a counterexample?

Best regards,

Hans Bolinder, Erlang/OTP

More information about the erlang-questions mailing list