Changeset View
Changeset View
Standalone View
Standalone View
src/validationinterface.h
Show All 36 Lines | |||||
* callbacks generated prior to now are finished when the function is called. | * callbacks generated prior to now are finished when the function is called. | ||||
* | * | ||||
* Be very careful blocking on func to be called if any locks are held - | * Be very careful blocking on func to be called if any locks are held - | ||||
* validation interface clients may not be able to make progress as they often | * validation interface clients may not be able to make progress as they often | ||||
* wait for things like cs_main, so blocking until func is called with cs_main | * wait for things like cs_main, so blocking until func is called with cs_main | ||||
* will result in a deadlock (that DEBUG_LOCKORDER will miss). | * will result in a deadlock (that DEBUG_LOCKORDER will miss). | ||||
*/ | */ | ||||
void CallFunctionInValidationInterfaceQueue(std::function<void()> func); | void CallFunctionInValidationInterfaceQueue(std::function<void()> func); | ||||
/** | |||||
* This is a synonym for the following, which asserts certain locks are not | |||||
* held: | |||||
* std::promise<void> promise; | |||||
* CallFunctionInValidationInterfaceQueue([&promise] { | |||||
* promise.set_value(); | |||||
* }); | |||||
* promise.get_future().wait(); | |||||
*/ | |||||
void SyncWithValidationInterfaceQueue(); | |||||
class CValidationInterface { | class CValidationInterface { | ||||
protected: | protected: | ||||
/** | /** | ||||
* Protected destructor so that instances can only be deleted by derived | * Protected destructor so that instances can only be deleted by derived | ||||
* classes. If that restriction is no longer desired, this should be made | * classes. If that restriction is no longer desired, this should be made | ||||
* public and virtual. | * public and virtual. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines |