What can I help you with?
NVIDIA Holoscan SDK v3.3.0

Class FileFIFOMutex

class FileFIFOMutex

A class that implements a file-based FIFO mutex.

This class implements a file-based mutex that can be used to synchronize multiple processes. It uses a lock file to synchronize the processes and a queue file to store the process IDs of the processes that are waiting to acquire the lock.

Public Functions

FileFIFOMutex(const FileFIFOMutex&) = delete
FileFIFOMutex &operator=(const FileFIFOMutex&) = delete
FileFIFOMutex() = delete
explicit FileFIFOMutex(std::string file_path)

Constructs a new file-backed mutex at the given path and a queue file at <file_path>.queue, if not already present. It also opens both the files.

Parameters

file_path – the path to the mutex file.

~FileFIFOMutex()

Unlocks the mutex if it was locked. Closes the queue and lock files.

void set_wait_time_ms(int wait_time_ms)

Sets the wait time for the lock. The wait time is applied when the queue file is being locked. If the queue file is not available for lock within the wait time, then the lock is not acquired. If the wait time is less than or equal to 0, then it blocks until the lock is acquired.

Parameters

wait_time_ms – The wait time in milliseconds.

void lock()

Locks the mutex after writing the current process’ PID to the queue. Waits for the queue file to be unlocked to write its own PID to the queue, depending on the wait time.

void unlock()

Unlocks the mutex by removing itself from the queue and unlocking the mutex.

bool locked() const

Returns true if the mutex is locked.

Returns

true When the mutex is locked.

Returns

false When the mutex is not locked.

Previous Class ExtensionManager
Next Template Class FlowGraph
© Copyright 2022-2025, NVIDIA. Last updated on May 29, 2025.