[Boost-bugs] [Boost C++ Libraries] #5833: once.cpp: call_onces swallows errors from CreateMutexA and WaitForSingleObject

Subject: [Boost-bugs] [Boost C++ Libraries] #5833: once.cpp: call_onces swallows errors from CreateMutexA and WaitForSingleObject
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-30 04:19:43


#5833: once.cpp: call_onces swallows errors from CreateMutexA and
WaitForSingleObject
--------------------------------+-------------------------------------------
 Reporter: noloader@… | Owner:
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost 1.47.0 | Severity: Problem
 Keywords: |
--------------------------------+-------------------------------------------
 Index: once.cpp
 ===================================================================
 RCS file: /cvsroot/boost/boost/libs/thread/src/once.cpp,v
 retrieving revision 1.27
 diff -r1.27 once.cpp
 157c157
 < HANDLE mutex = CreateMutexA(NULL, FALSE, strm.str().c_str());
 ---
> HANDLE mutex = CreateMutexA(NULL, FALSE, strm.str().c_str());
 160a161,162
> if(mutex == NULL)
> throw std::runtime_error("Failed to create one-time mutex");
 162,164c164,166
 < int res = 0;
 < res = WaitForSingleObject(mutex, INFINITE);
 < assert(res == WAIT_OBJECT_0);
 ---
> int wait1 = WAIT_OBJECT_0, res = 0;
> wait1 = WaitForSingleObject(mutex, INFINITE);
> assert(wait1 == WAIT_OBJECT_0);
 186a189,191
>
> if(wait1 != WAIT_OBJECT_0)
> throw std::runtime_error("Failed to wait on mutex");

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5833>
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