summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libthread.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/lib/libthread.tex')
-rw-r--r--Doc/lib/libthread.tex13
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/lib/libthread.tex b/Doc/lib/libthread.tex
index 4914948d..9e0c202 100644
--- a/Doc/lib/libthread.tex
+++ b/Doc/lib/libthread.tex
@@ -100,6 +100,19 @@ Return the status of the lock:\ \code{True} if it has been acquired by
some thread, \code{False} if not.
\end{methoddesc}
+In addition to these methods, lock objects can also be used via the
+\keyword{with} statement, e.g.:
+
+\begin{verbatim}
+from __future__ import with_statement
+import thread
+
+a_lock = thread.allocate_lock()
+
+with a_lock:
+ print "a_lock is locked while this executes"
+\end{verbatim}
+
\strong{Caveats:}
\begin{itemize}