3#include <xrpl/core/JobQueue.h>
24 template <
class Rep,
class Period>
46 using namespace std::chrono_literals;
52 cfg->FORCE_MULTI_THREAD =
true;
73 using namespace std::chrono_literals;
79 cfg->FORCE_MULTI_THREAD =
true;
95 using namespace std::chrono_literals;
103 static int const N = 4;
107 BEAST_EXPECT(*lv == -1);
110 jq.addJob(
jtCLIENT,
"LocalValTest", [&]() {
111 this->BEAST_EXPECT(*lv == -1);
113 this->BEAST_EXPECT(*lv == -2);
117 BEAST_EXPECT(*lv == -1);
119 for (
int i = 0; i < N; ++i)
121 jq.postCoro(
jtCLIENT,
"CoroTest", [&,
id = i](
auto const& c) {
126 this->BEAST_EXPECT(*lv == -1);
128 this->BEAST_EXPECT(*lv ==
id);
132 this->BEAST_EXPECT(*lv ==
id);
137 for (
auto const& c : a)
143 for (
auto const& c : a)
149 jq.addJob(
jtCLIENT,
"LocalValTest", [&]() {
150 this->BEAST_EXPECT(*lv == -2);
154 BEAST_EXPECT(*lv == -1);
166BEAST_DEFINE_TESTSUITE(Coroutine, core,
xrpl);
testcase_t testcase
Memberspace for declaring test cases.
virtual JobQueue & getJobQueue()=0
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.
std::condition_variable cv_
bool wait_for(std::chrono::duration< Rep, Period > const &rel_time)
void thread_specific_storage()
void run() override
Runs the suite.
A transaction testing environment.
std::unique_ptr< Config > envconfig()
creates and initializes a default configuration for jtx::Env
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.