3#include <xrpl/basics/LocalValue.h>
4#include <xrpl/core/ClosureCounter.h>
5#include <xrpl/core/JobTypeData.h>
6#include <xrpl/core/JobTypes.h>
7#include <xrpl/core/detail/Workers.h>
8#include <xrpl/json/json_value.h>
15#include <boost/context/protected_fixedsize_stack.hpp>
16#include <boost/coroutine2/coroutine.hpp>
57 boost::coroutines2::coroutine<void>::push_type*
yield_{};
58 boost::coroutines2::coroutine<void>::pull_type
coro_;
387#include <xrpl/core/Coro.ipp>
404 coro->expectEarlyExit();
A generic endpoint for log messages.
std::shared_ptr< Collector > ptr
A metric for measuring an integral value.
A reference to a handler for performing polled collection.
Coroutines must run to completion.
boost::coroutines2::coroutine< void >::pull_type coro_
Coro(Coro const &)=delete
boost::coroutines2::coroutine< void >::push_type * yield_
bool post()
Schedule coroutine execution.
bool runnable() const
Returns true if the Coro is still runnable (has not returned).
void yield() const
Suspend coroutine execution.
void expectEarlyExit()
Once called, the Coro allows early exit without an assert.
std::condition_variable cv_
Coro(CoroCreateT, JobQueue &, JobType, std::string, F &&)
void join()
Waits until coroutine returns from the user function.
Coro & operator=(Coro const &)=delete
void resume()
Resume coroutine execution.
int getJobCountGE(JobType t) const
All waiting jobs at or greater than this priority.
json::Value getJson(int c=0)
std::function< void()> JobFunction
void processTask(int instance) override
Perform a task.
JobTypeData & getJobTypeData(JobType type)
std::shared_ptr< Coro > postCoro(JobType t, std::string const &name, F &&f)
Creates a coroutine and adds a job to the queue which will run it.
int getJobCountTotal(JobType t) const
Jobs waiting plus running at this priority.
void rendezvous()
Block until no jobs running.
JobQueue(int threadCount, beast::insight::Collector::ptr const &collector, beast::Journal journal, Logs &logs, perf::PerfLog &perfLog)
std::atomic_bool stopping_
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
int getJobCount(JobType t) const
Jobs waiting at this priority.
beast::insight::Collector::ptr collector_
bool addRefCountedJob(JobType type, std::string const &name, JobFunction const &func)
std::atomic_bool stopped_
beast::insight::Gauge jobCount_
std::condition_variable cv_
static int getJobLimit(JobType type)
JobTypeData invalidJobData_
std::map< JobType, JobTypeData > JobDataMap
beast::insight::Hook hook_
void addLoadEvents(JobType t, int count, std::chrono::milliseconds elapsed)
Add multiple load events.
std::unique_ptr< LoadEvent > makeLoadEvent(JobType t, std::string const &name)
Return a scoped LoadEvent.
void finishJob(JobType type)
void getNextJob(Job &job)
Manages partitions for logging.
Workers is effectively a thread pool.
Singleton class that maintains performance counters and optionally writes Json-formatted data to a di...
Dummy class for unit tests.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
ClosureCounter< void > JobCounter
Called to perform tasks as needed.