Page MenuHomePhabricator

D9103.diff
No OneTemporary

D9103.diff

diff --git a/src/validationinterface.h b/src/validationinterface.h
--- a/src/validationinterface.h
+++ b/src/validationinterface.h
@@ -22,21 +22,24 @@
class uint256;
class CScheduler;
-// These functions dispatch to one or all registered wallets
-
-/** Register a wallet to receive updates from core */
-void RegisterValidationInterface(CValidationInterface *pwalletIn);
-/** Unregister a wallet from core */
-void UnregisterValidationInterface(CValidationInterface *pwalletIn);
-/** Unregister all wallets from core */
+/** Register subscriber */
+void RegisterValidationInterface(CValidationInterface *callbacks);
+/**
+ * Unregister subscriber. DEPRECATED. This is not safe to use when the RPC
+ * server or main message handler thread is running.
+ */
+void UnregisterValidationInterface(CValidationInterface *callbacks);
+/** Unregister all subscribers */
void UnregisterAllValidationInterfaces();
// Alternate registration functions that release a shared_ptr after the last
// notification is sent. These are useful for race-free cleanup, since
// unregistration is nonblocking and can return before the last notification is
// processed.
+/** Register subscriber */
void RegisterSharedValidationInterface(
std::shared_ptr<CValidationInterface> callbacks);
+/** Unregister subscriber */
void UnregisterSharedValidationInterface(
std::shared_ptr<CValidationInterface> callbacks);
diff --git a/src/validationinterface.cpp b/src/validationinterface.cpp
--- a/src/validationinterface.cpp
+++ b/src/validationinterface.cpp
@@ -124,10 +124,10 @@
}
void RegisterSharedValidationInterface(
- std::shared_ptr<CValidationInterface> pwalletIn) {
- // Each connection captures pwalletIn to ensure that each callback is
- // executed before pwalletIn is destroyed. For more details see #18338.
- g_signals.m_internals->Register(std::move(pwalletIn));
+ std::shared_ptr<CValidationInterface> callbacks) {
+ // Each connection captures the shared_ptr to ensure that each callback is
+ // executed before the subscriber is destroyed. For more details see #18338.
+ g_signals.m_internals->Register(std::move(callbacks));
}
void RegisterValidationInterface(CValidationInterface *callbacks) {
@@ -142,9 +142,9 @@
UnregisterValidationInterface(callbacks.get());
}
-void UnregisterValidationInterface(CValidationInterface *pwalletIn) {
+void UnregisterValidationInterface(CValidationInterface *callbacks) {
if (g_signals.m_internals) {
- g_signals.m_internals->Unregister(pwalletIn);
+ g_signals.m_internals->Unregister(callbacks);
}
}

File Metadata

Mime Type
text/plain
Expires
Sat, Apr 26, 10:16 (1 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5573217
Default Alt Text
D9103.diff (2 KB)

Event Timeline