--- lock_types.hpp~ 2016-11-21 21:29:59.000000000 -0200 +++ lock_types.hpp 2016-11-22 18:58:55.056399210 -0200 @@ -445,10 +445,15 @@ namespace boost } if (!owns_lock()) { +#if defined BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED boost::throw_exception( boost::lock_error(static_cast(system::errc::operation_not_permitted), "boost unique_lock doesn't own the mutex")); +#endif + } + else + { + m->unlock(); } - m->unlock(); is_locked = false; }