| 26 | namespace detail { |
| 27 | |
| 28 | sdk::BufferAnchor wrapPayloadAnchor(const PJ_payload_anchor_t& anchor, std::shared_ptr<void> library_keepalive) { |
| 29 | if (anchor.release == nullptr) { |
| 30 | return {}; |
| 31 | } |
| 32 | // Host-side deleter (always mapped): calls the plugin's release while holding |
| 33 | // `library_keepalive`, so the producing DSO stays mapped for the call and is |
| 34 | // dlclosed only once every anchor copy is destroyed. |
| 35 | auto release = anchor.release; |
| 36 | return sdk::BufferAnchor{std::shared_ptr<void>( |
| 37 | anchor.ctx, [release, keepalive = std::move(library_keepalive)](void* ctx) noexcept { release(ctx); })}; |
| 38 | } |
| 39 | |
| 40 | } // namespace detail |
| 41 |
no outgoing calls