Subject: [Boost-bugs] [Boost C++ Libraries] #9284: WaitForSingleObject(mutex) must handle WAIT_ABANDONED
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-22 05:47:55
#9284: WaitForSingleObject(mutex) must handle WAIT_ABANDONED
------------------------------+--------------------------
Reporter: huyuguang@⦠| Owner: igaztanaga
Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
Version: Boost 1.54.0 | Severity: Problem
Keywords: |
------------------------------+--------------------------
boost-1_54\boost\interprocess\sync\windows\winapi_mutex_wrapper.hpp
line 53
void lock()
{
if(winapi::wait_for_single_object(m_mtx_hnd, winapi::infinite_time)
!= winapi::wait_object_0){
error_info err = system_error_code();
throw interprocess_exception(err);
}
}
The wait_for_single_object maybe return wait_abandon which means the mutex
holder thread exited and did not release the mutex. Normally, this should
never happen, but if the mutext holder process crash, this will happen.
So the code should change to:
unsigned long ret = winapi::wait_for(...);
if(ret != winapi::wait_object_0 && ret != winapi::wait_abondon) {
error_info err = system_error_code();
throw interprocess_exception(err);
}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9284> 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:14 UTC