Subject: [Boost-bugs] [Boost C++ Libraries] #3572: mapped_file: reading/writing mapped memory can throw (structured) exceptions? (windows)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-10-28 11:48:59
#3572: mapped_file: reading/writing mapped memory can throw (structured)
exceptions? (windows)
----------------------------------------+-----------------------------------
Reporter: xurux1-mail@⦠| Owner: turkanis
Type: Bugs | Status: new
Milestone: Boost 1.41.0 | Component: iostreams
Version: Boost 1.40.0 | Severity: Problem
Keywords: mapped_file, documentation |
----------------------------------------+-----------------------------------
msdn: "Reading and Writing From a File View"
(http://msdn.microsoft.com/en-us/library/aa366801(VS.85).aspx)
"Reading from or writing to a file view can cause an
EXCEPTION_IN_PAGE_ERROR exception.
For example, accessing a mapped file that resides on a remote server can
generate an exception
if the connection to the server is lost. Exceptions can also occur because
of a full disk, an
underlying device failure, or a memory allocation failure. When writing to
a file view, exceptions
can also occur because the file is shared and a different process has
locked a byte range. To guard
against exceptions due to input and output (I/O) errors, all attempts to
access memory mapped files
should be wrapped in structured exception handlers"
DWORD dwLength;
__try
{
dwLength = *((LPDWORD) lpMapAddress);
}
__except(GetExceptionCode()==EXCEPTION_IN_PAGE_ERROR ?
EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
{
// Failed to read from the view.
}
... so it should be mentioned in the documentation?
(windows specific)
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/3572> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC