HomePhabricator

Give CValidationInterface Support for calling notifications on the CScheduler…

Description

Give CValidationInterface Support for calling notifications on the CScheduler Thread

Summary:

  • Use TestingSetup to DRY qt rpcnestedtests
  • Make ValidationInterface signals-type-agnostic

(by hiding boost::signals stuff in the .cpp)

This allows us to give it a bit more intelligence as we move
forward, including routing some signals through CScheduler. While
the introduction of a "internals" pointer in the class is pretty
ugly, the fact that we no longer need to include boost/signals
directly from validationinterface.h is very much worth the loss.

  • Give CMainSignals a reference to the global scheduler

...so that it can run some signals in the background later

  • Add default arg to CScheduler to schedule() a callback now
  • Support more than one CScheduler thread for serial clients

This will be used by CValidationInterface soon.

This requires a bit of work as we need to ensure that most of our
callbacks happen in-order (to avoid synchronization issues in
wallet) - we keep our own internal queue and push things onto it,
scheduling a queue-draining function immediately upon new
callbacks.

  • Flush CValidationInterface callbacks prior to destruction

Note that the CScheduler thread cant be running at this point,
it has already been stopped with the rest of the init threadgroup.
Thus, just calling any remaining loose callbacks during Shutdown()
is sane.

  • Expose if CScheduler is being serviced, assert its not in EmptyQueue

This is a backport of Core PR10179

Test Plan:

make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: jasonbcox, teamcity

Differential Revision: https://reviews.bitcoinabc.org/D1905

Details

Provenance
Matt Corallo <git@bluematt.me>Authored on Apr 27 2017, 00:13
deadalnixCommitted on Oct 14 2018, 18:54
schancelPushed on Oct 14 2018, 22:17
Reviewer
Restricted Project
Differential Revision
D1905: Give CValidationInterface Support for calling notifications on the CScheduler Thread
Parents
rSTAGING61657bb0b687: Add ability to assert a lock is not held in DEBUG_LOCKORDER
Branches
Unknown
Tags
Unknown