fs_flockfile()
void fs_flockfile (FS_FILE *p_file);
File |
Called from |
Code enabled by |
fs_api..c |
Application |
FS_CFG_API_EN and FS_CFG_FILE_LOCK_EN |
Acquire task ownership of a file.
Arguments
p_file
Pointer to a file.
Returned Value
None.
Notes/Warnings
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() (or fs_ftrylockfile()) and fs_funlockfile() can be nested.