Update information on the locking() function, added the needed constants.

(Thanks for the info, Tim!)
This commit is contained in:
Fred Drake 2000-12-14 03:11:24 +00:00
parent f7f88b11e4
commit f0b315478b
1 changed files with 26 additions and 2 deletions

View File

@ -20,10 +20,34 @@ API documentation.
\subsection{File Operations \label{msvcrt-files}}
\begin{funcdesc}{locking}{fd, mode, nbytes}
Lock part of a file based on a file descriptor from the C runtime.
Raises \exception{IOError} on failure.
Lock part of a file based on file descriptor \var{fd} from the C
runtime. Raises \exception{IOError} on failure. The locked region
of the file extends from the current file position for \var{nbytes}
bytes, and may continue beyond the end of the file. \var{mode} must
be one of the \constant{LK_\var{*}} constants listed below.
Multiple regions in a file may be locked at the same time, but may
not overlap. Adjacent regions are not merged; they must be unlocked
individually.
\end{funcdesc}
\begin{datadesc}{LK_LOCK}
\dataline{LK_RLCK}
Locks the specified bytes. If the bytes cannot be locked, the
program immediately tries again after 1 second. If, after 10
attempts, the bytes cannot be locked, \exception{IOError} is
raised.
\end{datadesc}
\begin{datadesc}{LK_NBLCK}
\dataline{LK_NBRLCK}
Locks the specified bytes. If the bytes cannot be locked,
\exception{IOError} is raised.
\end{datadesc}
\begin{datadesc}{LK_UNLCK}
Unlocks the specified bytes, which must have been previously locked.
\end{datadesc}
\begin{funcdesc}{setmode}{fd, flags}
Set the line-end translation mode for the file descriptor \var{fd}.
To set it to text mode, \var{flags} should be \constant{os.O_TEXT};