| 1 | #ifndef INCLUDED_START_ |
| 2 | #define INCLUDED_START_ |
| 3 | |
| 4 | #include "../../promisebase/promisebase.h" |
| 5 | |
| 6 | #include "../awaitable/awaitable.h" |
| 7 | |
| 8 | struct Start |
| 9 | { |
| 10 | struct State: public PromiseBase<Start, State> |
| 11 | {}; |
| 12 | |
| 13 | using Handle = std::coroutine_handle<State>; |
| 14 | |
| 15 | std::coroutine_handle<State> d_handle; |
| 16 | |
| 17 | public: |
| 18 | using promise_type = State; |
| 19 | |
| 20 | explicit Start(Handle handle); |
| 21 | ~Start(); |
| 22 | |
| 23 | Handle handle() const; |
| 24 | void go(); |
| 25 | |
| 26 | char const *name() const; |
| 27 | }; |
| 28 | |
| 29 | inline Start::Handle Start::handle() const |
| 30 | { |
| 31 | return d_handle; |
| 32 | } |
| 33 | |
| 34 | inline char const *Start::name() const |
| 35 | { |
| 36 | return "Start"; |
| 37 | } |
| 38 | |
| 39 | extern Start g_start; |
| 40 | |
| 41 | #endif |