FAT | RFS | XFS | ZFS

fcb_unlock()

PROTOTYPE

#include <stdio.h>

void fcb_unlock(FILE *file);

DESCRIPTION

fcb_unlock() releases a volume for use by any task, undoing the effect of fcb_lock().

fcb_lock() and fcb_unlock() support multitasking applications. If a task needs to update a file by multiple writes, these calls ensure these writes are not interspersed by writes from other tasks.

EXAMPLE

  /*-------------------------------------------------------------------*/
  /* Reserve volume for use by just this task.                         */
  /*-------------------------------------------------------------------*/
  fcb_lock(file);

  /*-------------------------------------------------------------------*/
  /* Write the string one character at a time.                         */
  /*-------------------------------------------------------------------*/
  while (*str)
    fputc(*str++, file);

  /*-------------------------------------------------------------------*/
  /* Release volume for use by other tasks.                            */
  /*-------------------------------------------------------------------*/
  fcb_unlock(file);