Boost logo

Boost :

Subject: [boost] [fiber] destruction order fiasco
From: Tatsuyuki Ishi (ishitatsuyuki_at_[hidden])
Date: 2016-11-15 06:25:21


The fiber still makes use of the scheduling algorithm after main context
exits, which is a problem for my case that puts a stack-allocated shared
data to the algorithm.

Some points:
https://github.com/boostorg/fiber/blob/master/src/context.cpp#L52 I doubt
if the schwarz counter is needed; isn't it only one?
https://github.com/boostorg/fiber/blob/master/src/scheduler.cpp#L137 I
don't think there's a need to wake it up; if it's sleeping, the thread is
blocked and it never enters here. This is the main problem: use-after-free.

Anyway, what I think is ideal is that just making the algorithm a reference
and assign it from the main context. An example of this approach is Qt's
Q*Application.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk