Currently, the potential for a deadlock exists if ActivateBestChain()
is called from within the ValidationInterface
scheduler thread. This is because ABC itself avoids overrunning the VI queue by waiting for it to drain once it has passed a certain depth.
To avoid this (or at least disallow it during CI runs), this change introduces thread_local state that gets set to indicate execution on ValidationInterface threads. If we’ve compiled with DEBUG_LOCKORDER
, calling ABC from within a VI thread throws an exception. A small, necessary refactoring on CMainSignals
is included.
This changeset also includes a commit from #13168 that limits the platforms where we can rely on the use of thread_local.