Optional
options: UdpBindLockOptionsAcquires the lock, waiting if necessary until it is available.
Optional
signal: null | AbortSignalAn optional AbortSignal to cancel the acquire operation.
A promise that resolves to a function that releases the lock.
Releases the lock.
Acquires the lock, executes the callback, and releases the lock.
Optional
signal: null | AbortSignalAn optional AbortSignal to cancel the acquire operation.
The result of the callback.
A class that provides a mechanism to ensure that only one instance of a process is running at a time by attempting to bind to a specific UDP port.
This is useful for preventing multiple instances of a script or application from running simultaneously.
Note: The lock is automatically released when the process exits, but it is recommended to call
releaseLock
explicitly when the lock is no longer needed.Example usage: