|
VLink
2.0.0
A high-performance communication middleware
|
Cross-process named semaphore backed by the host kernel. More...
Go to the source code of this file.
Classes | |
| class | vlink::SysSemaphore |
| Counting semaphore that can be shared across processes through an OS name. More... | |
Namespaces | |
| vlink | |
Cross-process named semaphore backed by the host kernel.
vlink::SysSemaphore wraps the platform IPC primitive that is closest to a counting semaphore: a POSIX named semaphore on Linux-like targets, a named Win32 semaphore on Windows, and a dispatch semaphore on macOS. Cross-process synchronisation works on every backend that exposes a kernel name; the macOS dispatch backend is process-local because Apple deprecated the named POSIX API.
Comparison with the in-process vlink::Semaphore:
| Aspect | Semaphore (in-process) | SysSemaphore (kernel) |
|---|---|---|
| Scope | Single process | Cross-process via OS name |
| Backing primitive | std::condition_variable | sem_open / CreateSemaphore |
| Naming | None (object handle only) | UTF-8 name (POSIX requires "/x") |
Signal-safe release | No | Yes on POSIX |
| Persistence | Bound to process lifetime | Persists in kernel namespace until unlinked |
Lifecycle:
attach(name) to create the kernel object or open an existing one.acquire and release for P/V.detach(force) explicitly, or rely on the destructor (force=false).attach() calls on a pre-existing kernel object inherit its current value.name and produces an in-process dispatch semaphore.