Mercurial > cpython-lru_cache-weakref
diff Doc/lib/libthread.tex @ 37259:af24eb3bbfce legacy-trunk
Document objects that can be used with the ``with`` statement.
| author | Phillip J. Eby <pje@telecommunity.com> |
|---|---|
| date | Tue, 28 Mar 2006 00:13:10 +0000 |
| parents | 21251e221e56 |
| children | 8b6017c937ac |
line wrap: on
line diff
--- a/Doc/lib/libthread.tex Tue Mar 28 00:08:22 2006 +0000 +++ b/Doc/lib/libthread.tex Tue Mar 28 00:13:10 2006 +0000 @@ -100,6 +100,19 @@ 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}
