facebookexperimental / facebookexperimental/libunifex

request_stop() return value is invalid

Open
#585 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
210
PR merge metrics
No merged PRs in 30d

Description

`request_stop()` [method](https://github.com/facebookexperimental/libunifex/blob/66d651157b42e06e7f96016479043f18f2234b82/source/inplace_stop_token.cpp#L72) in `stop_source` should return
> true if the stop_source object has a stop-state and this invocation made a stop request, otherwise false.

But your method returns false in case of successful request for the invocation.

The same logic I see in the [NVIDIA project ](https://github.com/NVIDIA/stdexec/blob/6f23dd5b1d523541ce28af32fc2603403ebd36ed/include/stdexec/stop_token.hpp#L288)

P.S. Also why did you skip `unlock()`? Is it really safe for 2 threads that make the stop_request ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.