Versions Compared

Key

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

The file module has functions lock files across several operations that are almost exact equivalents to POSIX API functions (see and Listing - File Module Function and Listing - POSIX API Equivalent); the primary difference is the advantage of valuable return error codes to the application.


Code Block
languagecpp
titleListing - File Module Function
linenumberstrue
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);



Code Block
languagecpp
titleListing - POSIX API Equivalent
linenumberstrue
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 Atomic File Operations Using File Lock - POSIX.