mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
scripted-diff: Rename SingleThreadedSchedulerClient to SerialTaskRunner
-BEGIN VERIFY SCRIPT-
s() { git grep -l "$1" src | (grep -v "$3" || cat;) | xargs sed -i "s/$1/$2/g"; }
s 'SingleThreadedSchedulerClient' 'SerialTaskRunner' ''
s 'SinglethreadedSchedulerClient' 'SerialTaskRunner' ''
s 'm_schedulerClient' 'm_task_runner' ''
s 'AddToProcessQueue' 'insert' ''
s 'EmptyQueue' 'flush' ''
s 'CallbacksPending' 'size' 'validation'
sed -i '109s/CallbacksPending/size/' src/validationinterface.cpp
-END VERIFY SCRIPT-
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
@@ -45,9 +45,9 @@ public:
|
||||
// We are not allowed to assume the scheduler only runs in one thread,
|
||||
// but must ensure all callbacks happen in-order, so we end up creating
|
||||
// our own queue here :(
|
||||
SingleThreadedSchedulerClient m_schedulerClient;
|
||||
SerialTaskRunner m_task_runner;
|
||||
|
||||
explicit MainSignalsImpl(CScheduler& scheduler LIFETIMEBOUND) : m_schedulerClient(scheduler) {}
|
||||
explicit MainSignalsImpl(CScheduler& scheduler LIFETIMEBOUND) : m_task_runner(scheduler) {}
|
||||
|
||||
void Register(std::shared_ptr<CValidationInterface> callbacks) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
|
||||
{
|
||||
@@ -101,12 +101,12 @@ CMainSignals::~CMainSignals() {}
|
||||
|
||||
void CMainSignals::FlushBackgroundCallbacks()
|
||||
{
|
||||
m_internals->m_schedulerClient.EmptyQueue();
|
||||
m_internals->m_task_runner.flush();
|
||||
}
|
||||
|
||||
size_t CMainSignals::CallbacksPending()
|
||||
{
|
||||
return m_internals->m_schedulerClient.CallbacksPending();
|
||||
return m_internals->m_task_runner.size();
|
||||
}
|
||||
|
||||
void CMainSignals::RegisterSharedValidationInterface(std::shared_ptr<CValidationInterface> callbacks)
|
||||
@@ -140,7 +140,7 @@ void CMainSignals::UnregisterAllValidationInterfaces()
|
||||
|
||||
void CMainSignals::CallFunctionInValidationInterfaceQueue(std::function<void()> func)
|
||||
{
|
||||
m_internals->m_schedulerClient.AddToProcessQueue(std::move(func));
|
||||
m_internals->m_task_runner.insert(std::move(func));
|
||||
}
|
||||
|
||||
void CMainSignals::SyncWithValidationInterfaceQueue()
|
||||
@@ -162,7 +162,7 @@ void CMainSignals::SyncWithValidationInterfaceQueue()
|
||||
do { \
|
||||
auto local_name = (name); \
|
||||
LOG_EVENT("Enqueuing " fmt, local_name, __VA_ARGS__); \
|
||||
m_internals->m_schedulerClient.AddToProcessQueue([=] { \
|
||||
m_internals->m_task_runner.insert([=] { \
|
||||
LOG_EVENT(fmt, local_name, __VA_ARGS__); \
|
||||
event(); \
|
||||
}); \
|
||||
|
||||
Reference in New Issue
Block a user