MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / wrapPayloadAnchor

Function wrapPayloadAnchor

pj_runtime/src/DataSourceRuntimeHost.cpp:28–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26namespace detail {
27
28sdk::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

Callers 3

makeLazyFetchClosureFunction · 0.85
TESTFunction · 0.85

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.68