Atomic File Operations Using File Lock
The file module has functions lock files across several operations that are almost exact equivalents to POSIX API functions; the primary difference is the advantage of valuable return error codes to the application.
File Module Function void FSFile_LockGet (FS_FILE *p_file, FS_ERR *p_err); void FSFile_LockAccept (FS_FILE *p_file, FS_ERR *p_err); void FSFile_LockSet (FS_FILE *p_file, FS_ERR *p_err); |
POSIX API Equivalent void fs_flockfile (FS_FILE *file); int fs_ftrylockfile (FS_FILE *file); void fs_funlockfile (FS_FILE *file); |
For more information about and an example of using file locking, see section 8-3-5 “Atomic File Operations Using File Lock” on page 106.