Module vidi::util::flock

source ·
Expand description

Locking files

Modules§

  • c 🔒

Structs§

  • Locks a file securely (requires lockf) Not reentrant on Linux. That is, even the same thread cannot acquire the same file twice. BUT if there are two copies of this software in the same process, those copies can both lock the same file. This can happen if two different versions of the library are used, for example.
  • Locks a file securely (requires lockf)

Enums§

  • LockBlock 🔒
    Should acquiring the lock block the caller?

Statics§

  • According to https://gavv.net/articles/file-locks/#lockf-function, lockf is stored in the kernel as [i-node, pid] pairs, allowing the process to access the device freely. Thus, the kernel alone will not prevent another piece of code in the same process from acquiring the same resource. For instance, another library, or another linked copy of libcamera. But we need each instance to be separate, so let’s keep a list of open instances here, and reject those used already.

Traits§

Type Aliases§