mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Logical markup.
This commit is contained in:
parent
9fee071ab6
commit
d678cb7a6c
2 changed files with 60 additions and 56 deletions
|
@ -20,7 +20,6 @@ IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread
|
||||||
|
|
||||||
It defines the following constant and functions:
|
It defines the following constant and functions:
|
||||||
|
|
||||||
\setindexsubitem{(in module thread)}
|
|
||||||
\begin{excdesc}{error}
|
\begin{excdesc}{error}
|
||||||
Raised on thread-specific errors.
|
Raised on thread-specific errors.
|
||||||
\end{excdesc}
|
\end{excdesc}
|
||||||
|
@ -34,12 +33,12 @@ then the thread exits (but other threads continue to run).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{exit}{}
|
\begin{funcdesc}{exit}{}
|
||||||
This is a shorthand for \code{thread.exit_thread()}.
|
This is a shorthand for \function{exit_thread()}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{exit_thread}{}
|
\begin{funcdesc}{exit_thread}{}
|
||||||
Raise the \code{SystemExit} exception. When not caught, this will
|
Raise the \exception{SystemExit} exception. When not caught, this
|
||||||
cause the thread to exit silently.
|
will cause the thread to exit silently.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
%\begin{funcdesc}{exit_prog}{status}
|
%\begin{funcdesc}{exit_prog}{status}
|
||||||
|
@ -62,10 +61,10 @@ data. Thread identifiers may be recycled when a thread exits and
|
||||||
another thread is created.
|
another thread is created.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
Lock objects have the following methods:
|
Lock objects have the following methods:
|
||||||
|
|
||||||
\setindexsubitem{(lock method)}
|
\begin{methoddesc}[lock]{acquire}{\optional{waitflag}}
|
||||||
\begin{funcdesc}{acquire}{\optional{waitflag}}
|
|
||||||
Without the optional argument, this method acquires the lock
|
Without the optional argument, this method acquires the lock
|
||||||
unconditionally, if necessary waiting until it is released by another
|
unconditionally, if necessary waiting until it is released by another
|
||||||
thread (only one thread at a time can acquire a lock --- that's their
|
thread (only one thread at a time can acquire a lock --- that's their
|
||||||
|
@ -74,52 +73,55 @@ reason for existence), and returns \code{None}. If the integer
|
||||||
if it is zero, the lock is only acquired if it can be acquired
|
if it is zero, the lock is only acquired if it can be acquired
|
||||||
immediately without waiting, while if it is nonzero, the lock is
|
immediately without waiting, while if it is nonzero, the lock is
|
||||||
acquired unconditionally as before. If an argument is present, the
|
acquired unconditionally as before. If an argument is present, the
|
||||||
return value is 1 if the lock is acquired successfully, 0 if not.
|
return value is \code{1} if the lock is acquired successfully,
|
||||||
\end{funcdesc}
|
\code{0} if not.
|
||||||
|
\end{methoddesc}
|
||||||
|
|
||||||
\begin{funcdesc}{release}{}
|
\begin{methoddesc}[lock]{release}{}
|
||||||
Releases the lock. The lock must have been acquired earlier, but not
|
Releases the lock. The lock must have been acquired earlier, but not
|
||||||
necessarily by the same thread.
|
necessarily by the same thread.
|
||||||
\end{funcdesc}
|
\end{methoddesc}
|
||||||
|
|
||||||
\begin{funcdesc}{locked}{}
|
\begin{methoddesc}[lock]{locked}{}
|
||||||
Return the status of the lock:\ 1 if it has been acquired by some
|
Return the status of the lock:\ \code{1} if it has been acquired by
|
||||||
thread, 0 if not.
|
some thread, \code{0} if not.
|
||||||
\end{funcdesc}
|
\end{methoddesc}
|
||||||
|
|
||||||
\strong{Caveats:}
|
\strong{Caveats:}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item
|
\item
|
||||||
Threads interact strangely with interrupts: the
|
Threads interact strangely with interrupts: the
|
||||||
\code{KeyboardInterrupt} exception will be received by an arbitrary
|
\exception{KeyboardInterrupt} exception will be received by an
|
||||||
thread. (When the \code{signal}\refbimodindex{signal} module is
|
arbitrary thread. (When the \module{signal}\refbimodindex{signal}
|
||||||
available, interrupts always go to the main thread.)
|
module is available, interrupts always go to the main thread.)
|
||||||
|
|
||||||
\item
|
\item
|
||||||
Calling \code{sys.exit()} or raising the \code{SystemExit} exception is
|
Calling \function{sys.exit()} or raising the \exception{SystemExit}
|
||||||
equivalent to calling \code{thread.exit_thread()}.
|
exception is equivalent to calling \function{exit_thread()}.
|
||||||
|
|
||||||
\item
|
\item
|
||||||
Not all built-in functions that may block waiting for I/O allow other
|
Not all built-in functions that may block waiting for I/O allow other
|
||||||
threads to run. (The most popular ones (\code{sleep()}, \code{read()},
|
threads to run. (The most popular ones (\function{time.sleep()},
|
||||||
\code{select()}) work as expected.)
|
\method{\var{file}.read()}, \function{select.select()}) work as
|
||||||
|
expected.)
|
||||||
|
|
||||||
\item
|
\item
|
||||||
It is not possible to interrupt the \code{acquire()} method on a lock
|
It is not possible to interrupt the \method{acquire()} method on a lock
|
||||||
-- the \code{KeyboardInterrupt} exception will happen after the lock
|
--- the \exception{KeyboardInterrupt} exception will happen after the
|
||||||
has been acquired.
|
lock has been acquired.
|
||||||
|
|
||||||
\item
|
\item
|
||||||
When the main thread exits, it is system defined whether the other
|
When the main thread exits, it is system defined whether the other
|
||||||
threads survive. On SGI IRIX using the native thread implementation,
|
threads survive. On SGI IRIX using the native thread implementation,
|
||||||
they survive. On most other systems, they are killed without
|
they survive. On most other systems, they are killed without
|
||||||
executing ``try-finally'' clauses or executing object destructors.
|
executing \keyword{try} ... \keyword{finally} clauses or executing
|
||||||
|
object destructors.
|
||||||
\indexii{threads}{IRIX}
|
\indexii{threads}{IRIX}
|
||||||
|
|
||||||
\item
|
\item
|
||||||
When the main thread exits, it doesn't do any of its usual cleanup
|
When the main thread exits, it does not do any of its usual cleanup
|
||||||
(except that ``try-finally'' clauses are honored), and the standard
|
(except that \keyword{try} ... \keyword{finally} clauses are honored),
|
||||||
I/O files are not flushed.
|
and the standard I/O files are not flushed.
|
||||||
|
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
|
@ -20,7 +20,6 @@ IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread
|
||||||
|
|
||||||
It defines the following constant and functions:
|
It defines the following constant and functions:
|
||||||
|
|
||||||
\setindexsubitem{(in module thread)}
|
|
||||||
\begin{excdesc}{error}
|
\begin{excdesc}{error}
|
||||||
Raised on thread-specific errors.
|
Raised on thread-specific errors.
|
||||||
\end{excdesc}
|
\end{excdesc}
|
||||||
|
@ -34,12 +33,12 @@ then the thread exits (but other threads continue to run).
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{exit}{}
|
\begin{funcdesc}{exit}{}
|
||||||
This is a shorthand for \code{thread.exit_thread()}.
|
This is a shorthand for \function{exit_thread()}.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
\begin{funcdesc}{exit_thread}{}
|
\begin{funcdesc}{exit_thread}{}
|
||||||
Raise the \code{SystemExit} exception. When not caught, this will
|
Raise the \exception{SystemExit} exception. When not caught, this
|
||||||
cause the thread to exit silently.
|
will cause the thread to exit silently.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
%\begin{funcdesc}{exit_prog}{status}
|
%\begin{funcdesc}{exit_prog}{status}
|
||||||
|
@ -62,10 +61,10 @@ data. Thread identifiers may be recycled when a thread exits and
|
||||||
another thread is created.
|
another thread is created.
|
||||||
\end{funcdesc}
|
\end{funcdesc}
|
||||||
|
|
||||||
|
|
||||||
Lock objects have the following methods:
|
Lock objects have the following methods:
|
||||||
|
|
||||||
\setindexsubitem{(lock method)}
|
\begin{methoddesc}[lock]{acquire}{\optional{waitflag}}
|
||||||
\begin{funcdesc}{acquire}{\optional{waitflag}}
|
|
||||||
Without the optional argument, this method acquires the lock
|
Without the optional argument, this method acquires the lock
|
||||||
unconditionally, if necessary waiting until it is released by another
|
unconditionally, if necessary waiting until it is released by another
|
||||||
thread (only one thread at a time can acquire a lock --- that's their
|
thread (only one thread at a time can acquire a lock --- that's their
|
||||||
|
@ -74,52 +73,55 @@ reason for existence), and returns \code{None}. If the integer
|
||||||
if it is zero, the lock is only acquired if it can be acquired
|
if it is zero, the lock is only acquired if it can be acquired
|
||||||
immediately without waiting, while if it is nonzero, the lock is
|
immediately without waiting, while if it is nonzero, the lock is
|
||||||
acquired unconditionally as before. If an argument is present, the
|
acquired unconditionally as before. If an argument is present, the
|
||||||
return value is 1 if the lock is acquired successfully, 0 if not.
|
return value is \code{1} if the lock is acquired successfully,
|
||||||
\end{funcdesc}
|
\code{0} if not.
|
||||||
|
\end{methoddesc}
|
||||||
|
|
||||||
\begin{funcdesc}{release}{}
|
\begin{methoddesc}[lock]{release}{}
|
||||||
Releases the lock. The lock must have been acquired earlier, but not
|
Releases the lock. The lock must have been acquired earlier, but not
|
||||||
necessarily by the same thread.
|
necessarily by the same thread.
|
||||||
\end{funcdesc}
|
\end{methoddesc}
|
||||||
|
|
||||||
\begin{funcdesc}{locked}{}
|
\begin{methoddesc}[lock]{locked}{}
|
||||||
Return the status of the lock:\ 1 if it has been acquired by some
|
Return the status of the lock:\ \code{1} if it has been acquired by
|
||||||
thread, 0 if not.
|
some thread, \code{0} if not.
|
||||||
\end{funcdesc}
|
\end{methoddesc}
|
||||||
|
|
||||||
\strong{Caveats:}
|
\strong{Caveats:}
|
||||||
|
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
\item
|
\item
|
||||||
Threads interact strangely with interrupts: the
|
Threads interact strangely with interrupts: the
|
||||||
\code{KeyboardInterrupt} exception will be received by an arbitrary
|
\exception{KeyboardInterrupt} exception will be received by an
|
||||||
thread. (When the \code{signal}\refbimodindex{signal} module is
|
arbitrary thread. (When the \module{signal}\refbimodindex{signal}
|
||||||
available, interrupts always go to the main thread.)
|
module is available, interrupts always go to the main thread.)
|
||||||
|
|
||||||
\item
|
\item
|
||||||
Calling \code{sys.exit()} or raising the \code{SystemExit} exception is
|
Calling \function{sys.exit()} or raising the \exception{SystemExit}
|
||||||
equivalent to calling \code{thread.exit_thread()}.
|
exception is equivalent to calling \function{exit_thread()}.
|
||||||
|
|
||||||
\item
|
\item
|
||||||
Not all built-in functions that may block waiting for I/O allow other
|
Not all built-in functions that may block waiting for I/O allow other
|
||||||
threads to run. (The most popular ones (\code{sleep()}, \code{read()},
|
threads to run. (The most popular ones (\function{time.sleep()},
|
||||||
\code{select()}) work as expected.)
|
\method{\var{file}.read()}, \function{select.select()}) work as
|
||||||
|
expected.)
|
||||||
|
|
||||||
\item
|
\item
|
||||||
It is not possible to interrupt the \code{acquire()} method on a lock
|
It is not possible to interrupt the \method{acquire()} method on a lock
|
||||||
-- the \code{KeyboardInterrupt} exception will happen after the lock
|
--- the \exception{KeyboardInterrupt} exception will happen after the
|
||||||
has been acquired.
|
lock has been acquired.
|
||||||
|
|
||||||
\item
|
\item
|
||||||
When the main thread exits, it is system defined whether the other
|
When the main thread exits, it is system defined whether the other
|
||||||
threads survive. On SGI IRIX using the native thread implementation,
|
threads survive. On SGI IRIX using the native thread implementation,
|
||||||
they survive. On most other systems, they are killed without
|
they survive. On most other systems, they are killed without
|
||||||
executing ``try-finally'' clauses or executing object destructors.
|
executing \keyword{try} ... \keyword{finally} clauses or executing
|
||||||
|
object destructors.
|
||||||
\indexii{threads}{IRIX}
|
\indexii{threads}{IRIX}
|
||||||
|
|
||||||
\item
|
\item
|
||||||
When the main thread exits, it doesn't do any of its usual cleanup
|
When the main thread exits, it does not do any of its usual cleanup
|
||||||
(except that ``try-finally'' clauses are honored), and the standard
|
(except that \keyword{try} ... \keyword{finally} clauses are honored),
|
||||||
I/O files are not flushed.
|
and the standard I/O files are not flushed.
|
||||||
|
|
||||||
\end{itemize}
|
\end{itemize}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue