11 #ifndef ASIO_COROUTINE_HPP 12 #define ASIO_COROUTINE_HPP 270 operator int()
const {
return value_; }
271 int&
operator=(
int v) { modified_ =
true;
return value_ = v; }
281 #define ASIO_CORO_REENTER(c) \ 282 switch (::asio::detail::coroutine_ref _coro_value = c) \ 283 case -1: if (_coro_value) \ 285 goto terminate_coroutine; \ 286 terminate_coroutine: \ 288 goto bail_out_of_coroutine; \ 289 bail_out_of_coroutine: \ 294 #define ASIO_CORO_YIELD_IMPL(n) \ 295 for (_coro_value = (n);;) \ 296 if (_coro_value == 0) \ 302 switch (_coro_value ? 0 : 1) \ 304 case -1: if (_coro_value) \ 305 goto terminate_coroutine; \ 307 case 1: if (_coro_value) \ 308 goto bail_out_of_coroutine; \ 311 #define ASIO_CORO_FORK_IMPL(n) \ 312 for (_coro_value = -(n);; _coro_value = (n)) \ 313 if (_coro_value == (n)) \ 320 #if defined(_MSC_VER) 321 # define ASIO_CORO_YIELD ASIO_CORO_YIELD_IMPL(__COUNTER__ + 1) 322 # define ASIO_CORO_FORK ASIO_CORO_FORK_IMPL(__COUNTER__ + 1) 323 #else // defined(_MSC_VER) 324 # define ASIO_CORO_YIELD ASIO_CORO_YIELD_IMPL(__LINE__) 325 # define ASIO_CORO_FORK ASIO_CORO_FORK_IMPL(__LINE__) 326 #endif // defined(_MSC_VER) 328 #endif // ASIO_COROUTINE_HPP
coroutine_ref(coroutine *c)
Provides support for implementing stackless coroutines.
bool is_parent() const
Returns true if the coroutine is the parent of a fork.
coroutine_ref(coroutine &c)
bool is_child() const
Returns true if the coroutine is the child of a fork.
coroutine()
Constructs a coroutine in its initial state.
bool is_complete() const
Returns true if the coroutine has reached its terminal state.