Closes an open file, console, FIFO, device, etc.
#include <nks/fsio.h> int NXClose ( NXHandle_t handle);
(IN) Specifies a file handle, which refers to a system-maintained state description for a file.
If successful, returns 0. Otherwise, returns a nonzero error code and the status of the description associated with the handle parameter is undefined.
NXClose dismantles the system-maintained state information associated with the passed-in file descriptor and frees any resources allocated to maintain such information. Any advisory locks that you hold on the file associated with handle are also removed.
If the file is marked for a deferred removal (see NXRemove), it is removed after the last file handle that refers to the file is closed.
The library handles any race conditions when closing a descriptor that multiple threads are using. When one or more threads are still actively performing I/O on a descriptor while yet another thread calls NXClose, the descriptor is removed from the table. NXClose then awaits for the I/O being performed by the other threads to finish before finalizing the file close operation.