Subject: Re: [Boost-bugs] [Boost C++ Libraries] #5859: win32 shared_mutex constructor leaks on exceptions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-12-04 15:38:11
#5859: win32 shared_mutex constructor leaks on exceptions
--------------------------------+-------------------------------------------
Reporter: phrosty@⦠| Owner: viboes
Type: Bugs | Status: assigned
Milestone: To Be Determined | Component: thread
Version: Boost 1.47.0 | Severity: Problem
Resolution: | Keywords: shared_mutex
--------------------------------+-------------------------------------------
Comment (by viboes):
In order to avoid a chained try-catch a no_throw
create_anonymous_semaphore_nothrow function can be used like in
{{{
if (!semaphores[exclusive_sem])
{
detail::win32::release_semaphore(semaphores[unlock_sem],LONG_MAX);
boost::throw_exception(thread_resource_error());
}
upgrade_sem=detail::win32::create_anonymous_semaphore_nothrow(0,LONG_MAX);
if (!upgrade_sem)
{
detail::win32::release_semaphore(semaphores[unlock_sem],LONG_MAX);
detail::win32::release_semaphore(semaphores[exclusive_sem],LONG_MAX);
boost::throw_exception(thread_resource_error());
}
}}}
While this is not too elegant it solves the issue. A RAI handle would be
also appreciated.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5859#comment:2> 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:07 UTC