Boost C++ Libraries: Ticket #8536: Repeated shared_mutex.unlock_shared() can underflow https://svn.boost.org/trac10/ticket/8536 <p> Boost 1.53's shared_mutex can underflow if the user calls unlock_shared twice or right after construction. </p> <p> shared_mutex m();<br /> m.unlock_shared(); </p> <p> The problem is specifically this line which can be found inside boost/thread/pthread/shared_mutex.hpp. <em>(should be line 148)</em> </p> <pre class="wiki"> bool const last_reader=!--state.shared_count; </pre><p> It doesn't check that state.shared_count is nonzero before decrementing. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8536 Trac 1.4.3 viboes Fri, 03 May 2013 20:07:50 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/8536#comment:1 https://svn.boost.org/trac10/ticket/8536#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> This is not a bug. It is a precondition that the mutex must be locked when you use unlock. </p> Ticket