...
A lock count is associated with each file:
- The file is unlocked when the lock count is zero.
- If the lock count is positive, a task owns the file.
- When
fs_flockfile()
is called, if… - …the lock count is zero OR
- …the lock count is positive and the caller owns the file…
…the lock count will be incremented and the caller will own the file. Otherwise, the caller will wait until the lock count returns to zero.
- Each call to
fs_funlockfile()
incremenets the lock count. - Matching calls to
fs_flockfile()
(orfs_ftrylockfile()
) andfs_funlockfile()
can be nested.