|
VLink
2.3.0
A high-performance communication middleware
|
Process-wide provider loader and shared-resource lifetime manager. More...
Go to the source code of this file.
Classes | |
| class | vlink::FastBufferManager |
Loads one FastBufferPluginInterface on first use. More... | |
Namespaces | |
| vlink | |
| vlink::zerocopy | |
Process-wide provider loader and shared-resource lifetime manager.
FastBufferManager owns the provider shared by every zerocopy::FastBuffer in the process. Construction of the first buffer resolves the provider through this singleton; nodes and CLI tools use the same selection without vendor SDK dependencies in VLink. The manager owns local references and one cross-process control block per exported allocation; buffers without sharing descriptors allocate no IPC state.
| First-use environment | Provider | Manager state |
|---|---|---|
| Unset or empty | Built-in ordinary CPU memory | Valid |
shm | Built-in shared CPU memory | Valid |
| Compatible plugin name or path | Loaded plugin | Valid |
| Missing or incompatible plugin | None | Invalid |
readers slot per allocation; further imports in that process share the local resource and only raise its local reference count. An import that attaches a new mapping fails when the reader table is full or the owner process is dead; the importer then removes the dead owner's control segment and asks the provider to destroy the native resource it names. Re-imports served by a local resource only raise its reference count. On Linux and QNX, manager construction also sweeps control segments of the same protocol left behind by dead owners; other protocols are left for a process of their own provider.zerocopy::FastBufferPool) or retiring it increments generation before the owner inspects readers; an importer claims its slot before comparing generation with the descriptor. Both sides use sequentially consistent operations so that at least one observes the other: the owner sees the claim and reports the allocation busy, or the importer sees the newer generation and fails as expired. In-process importers instead compare the generation and raise the local reference count under the registry mutex, which the owner also holds while checking that count. An importer that re-exports uses the generation it imported under, so a retired allocation never becomes importable again. Reclaiming also synchronizes the provider so local device work of released readers completes before the slot is handed out. An expired import drops the message exactly like a queue overflow, so a publisher never needs an import acknowledgement.Resolution happens once. Changing the environment after the first get() has no effect; an explicit load failure does not select another provider. The manager owns the provider; returned pointers are borrowed. Release buffers before manager shutdown, as with the recording plugin manager.