20 #include <ripple/core/JobQueue.h>
21 #include <ripple/beast/unit_test.h>
22 #include <test/jtx/Env.h>
35 JobQueue& jQueue = env.app().getJobQueue();
40 [&jobRan] (
Job&) { jobRan = true; }) ==
true);
43 while (jobRan ==
false);
49 using namespace std::chrono_literals;
52 jCounter.
join(
"JobQueue_test", 1s, j);
59 [&unprotected] (
Job&) { unprotected = false; }) ==
false);
67 JobQueue& jQueue = env.app().getJobQueue();
74 while (++yieldCount < 4)
77 BEAST_EXPECT (coro !=
nullptr);
80 while (yieldCount == 0);
84 while (coro->runnable())
86 BEAST_EXPECT (coro->post());
87 while (old == yieldCount) { }
89 BEAST_EXPECT (++old == yieldCount);
91 BEAST_EXPECT (yieldCount == 4);
99 while (++yieldCount < 4)
106 BEAST_EXPECT (
false);
114 int old = yieldCount;
115 while (coro->runnable())
118 BEAST_EXPECT (++old == yieldCount);
120 BEAST_EXPECT (yieldCount == 4);
126 using namespace std::chrono_literals;
129 jCounter.
join(
"JobQueue_test", 1s, j);
137 { unprotected =
false; });
138 BEAST_EXPECT (coro ==
nullptr);
BEAST_DEFINE_TESTSUITE(AccountDelete, app, ripple)
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.
JobCounter & jobCounter()
A generic endpoint for log messages.
A pool of threads to perform work.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void join(char const *name, std::chrono::milliseconds wait, beast::Journal j)
Returns once all counted in-flight closures are destroyed.
A transaction testing environment.