mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 01:07:57 +00:00
Revert unrelated changes
Signed-off-by: JCW <a1q123456@users.noreply.github.com>
This commit is contained in:
@@ -85,7 +85,6 @@ target_link_libraries(xrpl.libxrpl.basics PUBLIC xrpl.libxrpl.beast)
|
|||||||
add_module(xrpl json)
|
add_module(xrpl json)
|
||||||
target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics)
|
target_link_libraries(xrpl.libxrpl.json PUBLIC xrpl.libxrpl.basics)
|
||||||
|
|
||||||
|
|
||||||
add_module(xrpl crypto)
|
add_module(xrpl crypto)
|
||||||
target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics)
|
target_link_libraries(xrpl.libxrpl.crypto PUBLIC xrpl.libxrpl.basics)
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class Xrpl(ConanFile):
|
|||||||
'nudb/2.0.9',
|
'nudb/2.0.9',
|
||||||
'openssl/1.1.1w',
|
'openssl/1.1.1w',
|
||||||
'soci/4.0.3',
|
'soci/4.0.3',
|
||||||
'zlib/1.3.1'
|
'zlib/1.3.1',
|
||||||
]
|
]
|
||||||
|
|
||||||
test_requires = [
|
test_requires = [
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ enum Severity {
|
|||||||
kNone = kDisabled
|
kNone = kDisabled
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string
|
std::string_view
|
||||||
to_string(Severity severity);
|
to_string(Severity severity);
|
||||||
} // namespace severities
|
} // namespace severities
|
||||||
|
|
||||||
|
|||||||
@@ -94,29 +94,30 @@ Journal::getNullSink()
|
|||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
std::string
|
std::string_view
|
||||||
severities::to_string(Severity severity)
|
severities::to_string(Severity severity)
|
||||||
{
|
{
|
||||||
|
using namespace std::string_view_literals;
|
||||||
switch (severity)
|
switch (severity)
|
||||||
{
|
{
|
||||||
case kDisabled:
|
case kDisabled:
|
||||||
return "disabled";
|
return "disabled"sv;
|
||||||
case kTrace:
|
case kTrace:
|
||||||
return "trace";
|
return "trace"sv;
|
||||||
case kDebug:
|
case kDebug:
|
||||||
return "debug";
|
return "debug"sv;
|
||||||
case kInfo:
|
case kInfo:
|
||||||
return "info";
|
return "info"sv;
|
||||||
case kWarning:
|
case kWarning:
|
||||||
return "warning";
|
return "warning"sv;
|
||||||
case kError:
|
case kError:
|
||||||
return "error";
|
return "error"sv;
|
||||||
case kFatal:
|
case kFatal:
|
||||||
return "fatal";
|
return "fatal"sv;
|
||||||
default:
|
default:
|
||||||
UNREACHABLE("Unexpected severity value!");
|
UNREACHABLE("Unexpected severity value!");
|
||||||
}
|
}
|
||||||
return "";
|
return ""sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -175,74 +175,12 @@ public:
|
|||||||
BEAST_EXPECT(*lv == -1);
|
BEAST_EXPECT(*lv == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
test_yield_and_stop()
|
|
||||||
{
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
using namespace jtx;
|
|
||||||
|
|
||||||
testcase("yield and stop");
|
|
||||||
|
|
||||||
Env env(*this, envconfig([](std::unique_ptr<Config> cfg) {
|
|
||||||
cfg->FORCE_MULTI_THREAD = true;
|
|
||||||
return cfg;
|
|
||||||
}));
|
|
||||||
|
|
||||||
std::shared_ptr<JobQueue::Coro> c;
|
|
||||||
std::mutex mutexStop;
|
|
||||||
std::mutex mutexYield;
|
|
||||||
std::condition_variable cond;
|
|
||||||
std::condition_variable condYield;
|
|
||||||
bool yielded = false;
|
|
||||||
bool stopped = false;
|
|
||||||
|
|
||||||
env.app().getJobQueue().postCoro(
|
|
||||||
jtCLIENT, "Coroutine-Test", [&](auto const& cr) {
|
|
||||||
c = cr;
|
|
||||||
{
|
|
||||||
std::unique_lock lock(mutexYield);
|
|
||||||
yielded = true;
|
|
||||||
condYield.notify_all();
|
|
||||||
}
|
|
||||||
c->yield();
|
|
||||||
// Just to keep this job alive
|
|
||||||
std::this_thread::sleep_for(5ms);
|
|
||||||
});
|
|
||||||
std::thread th{[&]() {
|
|
||||||
std::unique_lock lock(mutexStop);
|
|
||||||
cond.wait(lock, [&]() { return stopped; });
|
|
||||||
// Delay a bit to wait for stop() to be called
|
|
||||||
std::this_thread::sleep_for(1ms);
|
|
||||||
c->post();
|
|
||||||
}};
|
|
||||||
|
|
||||||
// Delay a bit to wait for yield() to be called
|
|
||||||
std::this_thread::sleep_for(1ms);
|
|
||||||
std::unique_lock lockYield(mutexYield);
|
|
||||||
condYield.wait(lockYield, [&]() { return yielded; });
|
|
||||||
{
|
|
||||||
std::unique_lock lock(mutexStop);
|
|
||||||
stopped = true;
|
|
||||||
cond.notify_all();
|
|
||||||
}
|
|
||||||
env.app().getJobQueue().stop();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
th.join();
|
|
||||||
}
|
|
||||||
catch (std::exception const& e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pass();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
correct_order();
|
correct_order();
|
||||||
incorrect_order();
|
incorrect_order();
|
||||||
thread_specific_storage();
|
thread_specific_storage();
|
||||||
// test_yield_and_stop();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -180,13 +180,6 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Closure>
|
|
||||||
Substitute<Closure>
|
|
||||||
forceWrap(Closure&& closure)
|
|
||||||
{
|
|
||||||
return {*this, std::forward<Closure>(closure)};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Wrap the passed closure with a reference counter.
|
/** Wrap the passed closure with a reference counter.
|
||||||
|
|
||||||
@param closure Closure that accepts Args_t parameters and returns Ret_t.
|
@param closure Closure that accepts Args_t parameters and returns Ret_t.
|
||||||
|
|||||||
@@ -98,11 +98,6 @@ JobQueue::Coro::resume()
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::lock_guard lock(jq_.m_mutex);
|
std::lock_guard lock(jq_.m_mutex);
|
||||||
|
|
||||||
XRPL_ASSERT(
|
|
||||||
jq_.nSuspend_ > 0,
|
|
||||||
"ripple::JobQueue::Coro::resume jq_.nSuspend_ should be greater "
|
|
||||||
"than 0");
|
|
||||||
--jq_.nSuspend_;
|
--jq_.nSuspend_;
|
||||||
}
|
}
|
||||||
auto saved = detail::getLocalValues().release();
|
auto saved = detail::getLocalValues().release();
|
||||||
@@ -139,11 +134,6 @@ JobQueue::Coro::expectEarlyExit()
|
|||||||
// That said, since we're outside the Coro's stack, we need to
|
// That said, since we're outside the Coro's stack, we need to
|
||||||
// decrement the nSuspend that the Coro's call to yield caused.
|
// decrement the nSuspend that the Coro's call to yield caused.
|
||||||
std::lock_guard lock(jq_.m_mutex);
|
std::lock_guard lock(jq_.m_mutex);
|
||||||
|
|
||||||
XRPL_ASSERT(
|
|
||||||
jq_.nSuspend_ > 0,
|
|
||||||
"ripple::JobQueue::Coro::expectEarlyExit() jq_.nSuspend_ should be "
|
|
||||||
"greater than 0");
|
|
||||||
--jq_.nSuspend_;
|
--jq_.nSuspend_;
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
finished_ = true;
|
finished_ = true;
|
||||||
|
|||||||
@@ -304,10 +304,9 @@ JobQueue::stop()
|
|||||||
// but there may still be some threads between the return of
|
// but there may still be some threads between the return of
|
||||||
// `Job::doJob` and the return of `JobQueue::processTask`. That is why
|
// `Job::doJob` and the return of `JobQueue::processTask`. That is why
|
||||||
// we must wait on the condition variable to make these assertions.
|
// we must wait on the condition variable to make these assertions.
|
||||||
std::unique_lock lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
cv_.wait(lock, [this] {
|
cv_.wait(
|
||||||
return m_processCount == 0 && nSuspend_ == 0 && m_jobSet.empty();
|
lock, [this] { return m_processCount == 0 && m_jobSet.empty(); });
|
||||||
});
|
|
||||||
XRPL_ASSERT(
|
XRPL_ASSERT(
|
||||||
m_processCount == 0,
|
m_processCount == 0,
|
||||||
"ripple::JobQueue::stop : all processes completed");
|
"ripple::JobQueue::stop : all processes completed");
|
||||||
|
|||||||
Reference in New Issue
Block a user