Last updated: 2026-06-12
Inference Runtime
Process Lock
Cross-process GPU reservation lock keyed by backend and selected device.
ZINC uses a filesystem lock to stop multiple inference processes from loading different models onto the same physical GPU at once, which would otherwise produce confusing OOM failures and unstable benchmark results.
5 exports shown
enum
Backend
pub const Backend = enum Backend identifier encoded into the shared GPU lockfile name.
struct
ProcessLock
pub const ProcessLock = struct Cross-process lock handle that reserves one backend/device pair.
constant
AcquireError
pub const AcquireError = std.fs.File.OpenError || error{ Errors returned while acquiring a backend/device GPU reservation lock.
function
lockPath
pub fn lockPath(buffer: []u8, backend: Backend, device_index: u32) error{LockPathTooLong}![]const u8 Format the lockfile path for a backend/device pair into the caller-supplied buffer.
function
acquire
pub fn acquire(backend: Backend, device_index: u32) AcquireError!ProcessLock Acquire the cross-process GPU reservation lock for a backend/device pair.
Opens the lockfile in non-blocking exclusive mode so that a second process attempting to claim the same GPU immediately receives `error.GpuAlreadyReserved` rather than blocking indefinitely.