Subject: [Boost-bugs] [Boost C++ Libraries] #12547: yield_completion in fibers possibly destroys busy mutex
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2016-10-24 16:56:27
#12547: yield_completion in fibers possibly destroys busy mutex
-------------------------------------------------+-------------------------
Reporter: Thadeu Luiz Barbosa Dias | Owner: matias
<thadeuluiz@â¦> | Status: new
Type: Bugs | Component:
Milestone: To Be Determined | Documentation
Version: Boost 1.62.0 | Severity: Problem
Keywords: |
-------------------------------------------------+-------------------------
Im using something similar to this page:
http://www.boost.org/doc/libs/1_62_0/libs/fiber/doc/html/fiber/callbacks/then_there_s____boost_asio__.html
in my project but it contains a bug.
yield_completion::wait() does not reacquire the lock before returning,
therefore
async_result_base::get() and async_result<T>::get() might return before
the notifying thread(calling async_handler::operator() releases the lock.
with that, async_result<T> might be destroyed while the lock is being held
by the notifying thread causing a crash.
I assumed that the lock gets reacquired on fiber resume, but that is not
the case, lk.owns_lock() is false after the suspend statement.
the solution is to simply call lk.lock() after the suspend call on the
context.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12547> 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:20 UTC