|
Boost : |
Subject: Re: [boost] [afio] Formal review of Boost.AFIO
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2015-08-27 19:43:12
On 28/08/2015 01:01, Hartmut Kaiser wrote:
>>> (I assume it will eventually be closed once the futures that did succeed
>>> 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 do
> 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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk