Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d678cb7a
Commit
d678cb7a
authored
Apr 03, 1998
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logical markup.
parent
9fee071a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
56 deletions
+60
-56
Doc/lib/libthread.tex
Doc/lib/libthread.tex
+30
-28
Doc/libthread.tex
Doc/libthread.tex
+30
-28
No files found.
Doc/lib/libthread.tex
View file @
d678cb7a
...
...
@@ -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:
\setindexsubitem
{
(in module thread)
}
\begin{excdesc}
{
error
}
Raised on thread-specific errors.
\end{excdesc}
...
...
@@ -34,12 +33,12 @@ then the thread exits (but other threads continue to run).
\end{funcdesc}
\begin{funcdesc}
{
exit
}{}
This is a shorthand for
\
code
{
thread.
exit
_
thread()
}
.
This is a shorthand for
\
function
{
exit
_
thread()
}
.
\end{funcdesc}
\begin{funcdesc}
{
exit
_
thread
}{}
Raise the
\
code
{
SystemExit
}
exception. When not caught, this will
cause the thread to exit silently.
Raise the
\
exception
{
SystemExit
}
exception. When not caught, this
will
cause the thread to exit silently.
\end{funcdesc}
%\begin{funcdesc}{exit_prog}{status}
...
...
@@ -62,10 +61,10 @@ data. Thread identifiers may be recycled when a thread exits and
another thread is created.
\end{funcdesc}
Lock objects have the following methods:
\setindexsubitem
{
(lock method)
}
\begin{funcdesc}
{
acquire
}{
\optional
{
waitflag
}}
\begin{methoddesc}
[lock]
{
acquire
}{
\optional
{
waitflag
}}
Without the optional argument, this method acquires the lock
unconditionally, if necessary waiting until it is released by another
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
immediately without waiting, while if it is nonzero, the lock is
acquired unconditionally as before. If an argument is present, the
return value is 1 if the lock is acquired successfully, 0 if not.
\end{funcdesc}
return value is
\code
{
1
}
if the lock is acquired successfully,
\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
necessarily by the same thread.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
locked
}{}
Return the status of the lock:
\
1 if it has been acquired by some
thread, 0
if not.
\end{
func
desc}
\begin{
methoddesc}
[lock]
{
locked
}{}
Return the status of the lock:
\
\code
{
1
}
if it has been acquired by
some thread,
\code
{
0
}
if not.
\end{
method
desc}
\strong
{
Caveats:
}
\begin{itemize}
\item
Threads interact strangely with interrupts: the
\
code
{
KeyboardInterrupt
}
exception will be received by an arbitrary
thread. (When the
\code
{
signal
}
\refbimodindex
{
signal
}
module is
available, interrupts always go to the main thread.)
\
exception
{
KeyboardInterrupt
}
exception will be received by an
arbitrary thread. (When the
\module
{
signal
}
\refbimodindex
{
signal
}
module is
available, interrupts always go to the main thread.)
\item
Calling
\
code
{
sys.exit()
}
or raising the
\code
{
SystemExit
}
exception is
e
quivalent to calling
\code
{
thread.
exit
_
thread()
}
.
Calling
\
function
{
sys.exit()
}
or raising the
\exception
{
SystemExit
}
e
xception is equivalent to calling
\function
{
exit
_
thread()
}
.
\item
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()
}
,
\code
{
select()
}
) work as expected.)
threads to run. (The most popular ones (
\function
{
time.sleep()
}
,
\method
{
\var
{
file
}
.read()
}
,
\function
{
select.select()
}
) work as
expected.)
\item
It is not possible to interrupt the
\
code
{
acquire()
}
method on a lock
--
the
\code
{
KeyboardInterrupt
}
exception will happen after the lock
has been acquired.
It is not possible to interrupt the
\
method
{
acquire()
}
method on a lock
--
- the
\exception
{
KeyboardInterrupt
}
exception will happen after the
lock
has been acquired.
\item
When the main thread exits, it is system defined whether the other
threads survive. On SGI IRIX using the native thread implementation,
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
}
\item
When the main thread exits, it does
n'
t do any of its usual cleanup
(except that
``try-finally'' clauses are honored), and the standard
I/O files are not flushed.
When the main thread exits, it does
no
t do any of its usual cleanup
(except that
\keyword
{
try
}
...
\keyword
{
finally
}
clauses are honored),
and the standard
I/O files are not flushed.
\end{itemize}
Doc/libthread.tex
View file @
d678cb7a
...
...
@@ -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:
\setindexsubitem
{
(in module thread)
}
\begin{excdesc}
{
error
}
Raised on thread-specific errors.
\end{excdesc}
...
...
@@ -34,12 +33,12 @@ then the thread exits (but other threads continue to run).
\end{funcdesc}
\begin{funcdesc}
{
exit
}{}
This is a shorthand for
\
code
{
thread.
exit
_
thread()
}
.
This is a shorthand for
\
function
{
exit
_
thread()
}
.
\end{funcdesc}
\begin{funcdesc}
{
exit
_
thread
}{}
Raise the
\
code
{
SystemExit
}
exception. When not caught, this will
cause the thread to exit silently.
Raise the
\
exception
{
SystemExit
}
exception. When not caught, this
will
cause the thread to exit silently.
\end{funcdesc}
%\begin{funcdesc}{exit_prog}{status}
...
...
@@ -62,10 +61,10 @@ data. Thread identifiers may be recycled when a thread exits and
another thread is created.
\end{funcdesc}
Lock objects have the following methods:
\setindexsubitem
{
(lock method)
}
\begin{funcdesc}
{
acquire
}{
\optional
{
waitflag
}}
\begin{methoddesc}
[lock]
{
acquire
}{
\optional
{
waitflag
}}
Without the optional argument, this method acquires the lock
unconditionally, if necessary waiting until it is released by another
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
immediately without waiting, while if it is nonzero, the lock is
acquired unconditionally as before. If an argument is present, the
return value is 1 if the lock is acquired successfully, 0 if not.
\end{funcdesc}
return value is
\code
{
1
}
if the lock is acquired successfully,
\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
necessarily by the same thread.
\end{
func
desc}
\end{
method
desc}
\begin{
funcdesc}
{
locked
}{}
Return the status of the lock:
\
1 if it has been acquired by some
thread, 0
if not.
\end{
func
desc}
\begin{
methoddesc}
[lock]
{
locked
}{}
Return the status of the lock:
\
\code
{
1
}
if it has been acquired by
some thread,
\code
{
0
}
if not.
\end{
method
desc}
\strong
{
Caveats:
}
\begin{itemize}
\item
Threads interact strangely with interrupts: the
\
code
{
KeyboardInterrupt
}
exception will be received by an arbitrary
thread. (When the
\code
{
signal
}
\refbimodindex
{
signal
}
module is
available, interrupts always go to the main thread.)
\
exception
{
KeyboardInterrupt
}
exception will be received by an
arbitrary thread. (When the
\module
{
signal
}
\refbimodindex
{
signal
}
module is
available, interrupts always go to the main thread.)
\item
Calling
\
code
{
sys.exit()
}
or raising the
\code
{
SystemExit
}
exception is
e
quivalent to calling
\code
{
thread.
exit
_
thread()
}
.
Calling
\
function
{
sys.exit()
}
or raising the
\exception
{
SystemExit
}
e
xception is equivalent to calling
\function
{
exit
_
thread()
}
.
\item
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()
}
,
\code
{
select()
}
) work as expected.)
threads to run. (The most popular ones (
\function
{
time.sleep()
}
,
\method
{
\var
{
file
}
.read()
}
,
\function
{
select.select()
}
) work as
expected.)
\item
It is not possible to interrupt the
\
code
{
acquire()
}
method on a lock
--
the
\code
{
KeyboardInterrupt
}
exception will happen after the lock
has been acquired.
It is not possible to interrupt the
\
method
{
acquire()
}
method on a lock
--
- the
\exception
{
KeyboardInterrupt
}
exception will happen after the
lock
has been acquired.
\item
When the main thread exits, it is system defined whether the other
threads survive. On SGI IRIX using the native thread implementation,
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
}
\item
When the main thread exits, it does
n'
t do any of its usual cleanup
(except that
``try-finally'' clauses are honored), and the standard
I/O files are not flushed.
When the main thread exits, it does
no
t do any of its usual cleanup
(except that
\keyword
{
try
}
...
\keyword
{
finally
}
clauses are honored),
and the standard
I/O files are not flushed.
\end{itemize}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment