Provides support for implementing stackless coroutines. * The @c coroutine class may be used to implement stackless coroutines. The * class itself is used to store the current state of the coroutine. * * Coroutines are copy-constructible and assignable, and the space overhead is * a single int. They can be used as a base class: * * @code class session : coroutine * { * ... * }; @endcode
| 243 | * @li @c BOOST_ASIO_CORO_FORK instead of @c fork |
| 244 | */ |
| 245 | class coroutine |
| 246 | { |
| 247 | public: |
| 248 | /// Constructs a coroutine in its initial state. |
| 249 | coroutine() : value_(0) {} |
| 250 | |
| 251 | /// Returns true if the coroutine is the child of a fork. |
| 252 | bool is_child() const { return value_ < 0; } |
| 253 | |
| 254 | /// Returns true if the coroutine is the parent of a fork. |
| 255 | bool is_parent() const { return !is_child(); } |
| 256 | |
| 257 | /// Returns true if the coroutine has reached its terminal state. |
| 258 | bool is_complete() const { return value_ == -1; } |
| 259 | |
| 260 | private: |
| 261 | friend class detail::coroutine_ref; |
| 262 | int value_; |
| 263 | }; |
| 264 | |
| 265 | namespace detail { |
| 266 |
no outgoing calls
no test coverage detected