Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2015-08-27 23:12:41
> On 28/08/2015 01:01, Hartmut Kaiser wrote:
> >>> (I assume it will eventually be closed once the futures that did
> >>> fall out of scope.)
> >> You should always explicitly issue async_close() when you can because
> >> closing a file handle can be very expensive on Windows and OS X.
> >> If you forget, when shared_ptr count hits zero the handle is
> >> destructed and the handle fsynced (if flags say so) and closed
> >> synchronously. I have a todo item that I really should either detach
> >> destructor induced handle closes as I can't throw up any exceptions
> >> which occur anyway, or fatally exit the process because you forgot to
> >> close the handle. One or the other (user selectable of course).
> > Not closing a file should be impossible in C++! How can you 'forget' to
> > that if your destructor does it (if not done explicitly)? All of this is
> > sooo wrong!
> I think you need to go back and re-read what he said.
I did read it several times and I admit my head spins. I have no idea what a
'detach destructor induced handle close' is (can we use
Standard-terminology, please?). I (perhaps wrongly) assumed it means not
closing the handle in the destructor.