1#include <test/jtx/Env.h>
3#include <xrpl/beast/unit_test.h>
4#include <xrpl/core/JobQueue.h>
18 JobQueue& jQueue = env.app().getJobQueue();
23 jQueue.
addJob(
jtCLIENT,
"JobAddTest1", [&jobRan]() { jobRan = true; }) ==
true);
33 using namespace std::chrono_literals;
39 bool unprotected =
false;
40 BEAST_EXPECT(jQueue.
addJob(
jtCLIENT,
"JobAddTest2", [&unprotected]() {
51 JobQueue& jQueue = env.app().getJobQueue();
59 while (++yieldCount < 4)
62 BEAST_EXPECT(coro !=
nullptr);
65 while (yieldCount == 0)
70 while (coro->runnable())
72 BEAST_EXPECT(coro->post());
73 while (old == yieldCount)
77 BEAST_EXPECT(++old == yieldCount);
79 BEAST_EXPECT(yieldCount == 4);
88 while (++yieldCount < 4)
103 int old = yieldCount;
104 while (coro->runnable())
107 BEAST_EXPECT(++old == yieldCount);
109 BEAST_EXPECT(yieldCount == 4);
115 using namespace std::chrono_literals;
121 bool unprotected =
false;
126 BEAST_EXPECT(coro ==
nullptr);
A pool of threads to perform work.
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.
bool addJob(JobType type, std::string const &name, JobHandler &&jobHandler)
Adds a job to the JobQueue.
void run() override
Runs the suite.
A transaction testing environment.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.