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

  1. A lock count is associated with each file:
    1. The file is unlocked when the lock count is zero.
    2. If the lock count is positive, a task owns the file.
    3. When fs_flockfile() is called, if…
      1. …the lock count is zero OR
      2. …the lock count is positive and the caller owns the file…
      3. …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.
    4. Each call to fs_funlockfile() incremenets the lock count.
    5. Matching calls to fs_flockfile() (or fs_ftrylockfile()) and fs_funlockfile() can be nested.