]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update information on the locking() function, added the needed constants.
authorFred Drake <fdrake@acm.org>
Thu, 14 Dec 2000 03:11:24 +0000 (03:11 +0000)
committerFred Drake <fdrake@acm.org>
Thu, 14 Dec 2000 03:11:24 +0000 (03:11 +0000)
(Thanks for the info, Tim!)

Doc/lib/libmsvcrt.tex

index 7e4c417739b037000557b580263960d72c9fcd61..b0fed815a006643db17c544096f5e6e314ba9f94 100644 (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};