Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Each file actually has a lock count associated with it. This allows nested calls by a task to acquire a file lock; each of those calls must be matched with a call to fs_funlockfile().

Listing 10-4 Example file lock usage

L10-4(1) fs_flockfile() will block the calling task until the file is available. If the task must write to the file only if no other task is currently accessing it, the non-blocking function fs_funlockfile() can be used.