jthread
jthread copied to clipboard
Stop token internal state double delete issue.
https://github.com/josuttis/jthread/blob/0fa8d394254886c555d6faccd0a3de819b7d47f8/source/stop_token.hpp#L56
Hi everyone,
If you have two stop_token(s) alive and the originating source has already been destroyed, the first of the two remaining tokens that is destroyed will delete the internal state, and the second will double delete.
If my understanding of the code is correct, the test should be (in __remove_token_reference):
if (__oldState < (__token_ref_increment + __token_ref_increment))
Pull request: https://github.com/josuttis/jthread/pull/43