refactor: Add CleanupRun function to dedup clean list code #130

pull ryanofsky wants to merge 1 commits into bitcoin-core:master from ryanofsky:pr/cleanupcleanup changing 4 files +33 −29
  1. ryanofsky commented at 1:47 PM on January 23, 2025: collaborator

    Add CleanupRun function to dedup clean list code. Also rename "cleanup" variables to distinguish between cleanup iterators and cleanup callback functions.

    These changes were originally part of https://github.com/chaincodelabs/libmultiprocess/pull/126 which was closed for other reasons, but I think they are still helpful and make code easier to navigate.

    Since this renames a public struct member, it will require a change to bitcoin core when the depends version is bumped:

    diff --git a/src/ipc/capnp/protocol.cpp b/src/ipc/capnp/protocol.cpp
    index 4b67a5bd1e36..691bdf5f9242 100644
    --- a/src/ipc/capnp/protocol.cpp
    +++ b/src/ipc/capnp/protocol.cpp
    @@ -73,7 +73,7 @@ public:
         }
         void addCleanup(std::type_index type, void* iface, std::function<void()> cleanup) override
         {
    -        mp::ProxyTypeRegister::types().at(type)(iface).cleanup.emplace_back(std::move(cleanup));
    +        mp::ProxyTypeRegister::types().at(type)(iface).cleanup_fns.emplace_back(std::move(cleanup));
         }
         Context& context() override { return m_context; }
         void startLoop(const char* exe_name)
    
  2. refactor: Add CleanupRun function to dedup clean list code
    Also rename "cleanup" variables to distinguish between cleanup iterators and
    cleanup callback functions.
    700085f9a8
  3. ryanofsky force-pushed on Jan 27, 2025
  4. ryanofsky commented at 3:13 PM on January 27, 2025: collaborator

    Updated 7d08d83b7a7895a8ea070f16426a8527509f237d -> 700085f9a8e5f8bf1b200c4c09c8314b186c150a (pr/cleanupcleanup.1 -> pr/cleanupcleanup.2, compare) tweaking to delete the cleanup functions after running them, which might be useful in case they are holding on to any state.

  5. ryanofsky merged this on Jan 27, 2025
  6. ryanofsky closed this on Jan 27, 2025

  7. Sjors referenced this in commit 57e60735cf on Jan 27, 2025
  8. Sjors referenced this in commit 71be9377ee on Jan 27, 2025
  9. ryanofsky referenced this in commit 90b116bd70 on Jan 27, 2025
  10. ryanofsky referenced this in commit 2221c8814d on Jan 27, 2025
  11. Sjors referenced this in commit b66fe2fc03 on Jan 28, 2025
  12. fanquake referenced this in commit ad2f9324c6 on Jan 29, 2025
  13. janus referenced this in commit 311822f35f on Sep 1, 2025
  14. bitcoin-core locked this on Jan 27, 2026
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 18:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me