refactor: Replace EventLoop::post() with sync() taking kj::FunctionParam #347

pull ViniciusCestarii wants to merge 2 commits into bitcoin-core:master from ViniciusCestarii:refact-sync changing 4 files +27 −27
  1. ViniciusCestarii commented at 2:56 PM on August 16, 2026: contributor

    EventLoop::post() and the sync() wrapper around it did the same thing, so this merges them into a single sync() method. And also takes the callback as a kj::FunctionParam instead of a kj::Function: FunctionParam stores only a pointer to the caller's callable rather than taking ownership of it, so the callable no longer needs to be copyable or movable, and each call avoids a heap allocation.

    This is safe because sync() does not return until the event loop thread has finished running the callback and cleared m_post_fn(now named m_sync_fn), so the pointer is never used after the callable goes out of scope.

  2. refactor: replace EventLoop::post() with sync() taking kj::FunctionParam d6f7443370
  3. refactor: rename EventLoop::m_post_fn to m_sync_fn 2b23e78b35
  4. DrahtBot commented at 2:56 PM on August 16, 2026: none

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process.

    Type Reviewers
    Concept ACK ryanofsky

    If your review is incorrectly listed, please copy-paste <code>&lt;!--meta-tag:bot-skip--&gt;</code> into the comment that the bot should ignore.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. ryanofsky commented at 11:03 PM on August 25, 2026: collaborator

    Concept ACK 2b23e78b35fe0208a782db17e49b04c4f03aa088. Looks like a nice efficiency improvement!

    Note that we should be able to make this more efficient by dropping the pipe used to wake the event loop and using the cross-thread mechanisms newer versions of capnproto provide (kj::Executor, kj::newPromiseAndCrossThreadFulfiller, or kj::EventPort::wake). But this PR is a nice targetted improvement.


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-08-26 00:30 UTC

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