Opened 6 years ago
Closed 5 years ago
#12547 closed Bugs (fixed)
yield_completion in fibers possibly destroys busy mutex
Reported by: | Owned by: | olli | |
---|---|---|---|
Milestone: | To Be Determined | Component: | Documentation |
Version: | Boost 1.62.0 | Severity: | Problem |
Keywords: | Cc: |
Description
Im using something similar to this page:
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.
Change History (2)
comment:1 by , 6 years ago
Owner: | changed from | to
---|
comment:2 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
should be fixed in #99 (https://github.com/boostorg/fiber/issues/99)