|
xrpld
|
Coroutines must run to completion. More...
#include <JobQueue.h>


Public Member Functions | |
| template<class F> | |
| Coro (CoroCreateT, JobQueue &, JobType, std::string, F &&) | |
| Coro (Coro const &)=delete | |
| Coro & | operator= (Coro const &)=delete |
| ~Coro () | |
| void | yield () const |
| Suspend coroutine execution. | |
| bool | post () |
| Schedule coroutine execution. | |
| void | resume () |
| Resume coroutine execution. | |
| bool | runnable () const |
| Returns true if the Coro is still runnable (has not returned). | |
| void | expectEarlyExit () |
| Once called, the Coro allows early exit without an assert. | |
| void | join () |
| Waits until coroutine returns from the user function. | |
| T | shared_from_this (T... args) |
| T | weak_from_this (T... args) |
Private Attributes | |
| detail::LocalValues | lvs_ |
| JobQueue & | jq_ |
| JobType | type_ |
| std::string | name_ |
| bool | running_ {false} |
| std::mutex | mutex_ |
| std::mutex | mutexRun_ |
| std::condition_variable | cv_ |
| boost::coroutines2::coroutine< void >::push_type * | yield_ {} |
| boost::coroutines2::coroutine< void >::pull_type | coro_ |
| bool | finished_ = false |
Coroutines must run to completion.
Definition at line 65 of file JobQueue.h.
| xrpl::JobQueue::Coro::Coro | ( | CoroCreateT | , |
| JobQueue & | , | ||
| JobType | , | ||
| std::string | , | ||
| F && | ) |
|
delete |
| xrpl::JobQueue::Coro::~Coro | ( | ) |
| void xrpl::JobQueue::Coro::yield | ( | ) | const |
| bool xrpl::JobQueue::Coro::post | ( | ) |
Schedule coroutine execution.
Effects: Returns immediately. A new job is scheduled to resume the execution of the coroutine. When the job runs, the coroutine's stack is restored and execution continues at the beginning of coroutine function or the statement after the previous call to yield. Undefined behavior if called after the coroutine has completed with a return (as opposed to a yield()). Undefined behavior if post() or resume() called consecutively without a corresponding yield.
| void xrpl::JobQueue::Coro::resume | ( | ) |
Resume coroutine execution.
Effects: The coroutine continues execution from where it last left off using this same thread. If the coroutine has already completed, returns immediately (handles the documented post-before-yield race condition). Undefined behavior if resume() or post() called consecutively without a corresponding yield.
|
nodiscard |
Returns true if the Coro is still runnable (has not returned).
| void xrpl::JobQueue::Coro::expectEarlyExit | ( | ) |
Once called, the Coro allows early exit without an assert.
| void xrpl::JobQueue::Coro::join | ( | ) |
Waits until coroutine returns from the user function.
|
private |
Definition at line 68 of file JobQueue.h.
|
private |
Definition at line 69 of file JobQueue.h.
|
private |
Definition at line 70 of file JobQueue.h.
|
private |
Definition at line 71 of file JobQueue.h.
|
private |
Definition at line 72 of file JobQueue.h.
|
private |
Definition at line 73 of file JobQueue.h.
|
private |
Definition at line 74 of file JobQueue.h.
|
private |
Definition at line 75 of file JobQueue.h.
|
private |
Definition at line 76 of file JobQueue.h.
|
private |
Definition at line 77 of file JobQueue.h.
|
private |
Definition at line 79 of file JobQueue.h.