From cbeaa91dbb1bc3ee6c05f3ee55a71268b8db2035 Mon Sep 17 00:00:00 2001 From: Jesse Cohen Date: Wed, 16 May 2018 16:20:37 -0400 Subject: [PATCH] Update ValidationInterface() documentation to explicitly specify threading and memory model --- src/validationinterface.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/validationinterface.h b/src/validationinterface.h index 63097166a..00efc085b 100644 --- a/src/validationinterface.h +++ b/src/validationinterface.h @@ -53,6 +53,21 @@ void CallFunctionInValidationInterfaceQueue(std::function func); */ void SyncWithValidationInterfaceQueue(); +/** + * Implement this to subscribe to events generated in validation + * + * Each CValidationInterface() subscriber will receive event callbacks + * in the order in which the events were generated by validation. + * Furthermore, each ValidationInterface() subscriber may assume that + * callbacks effectively run in a single thread with single-threaded + * memory consistency. That is, for a given ValidationInterface() + * instantiation, each callback will complete before the next one is + * invoked. This means, for example when a block is connected that the + * UpdatedBlockTip() callback may depend on an operation performed in + * the BlockConnected() callback without worrying about explicit + * synchronization. No ordering should be assumed across + * ValidationInterface() subscribers. + */ class CValidationInterface { protected: /**