Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d678cb7a
Kaydet (Commit)
d678cb7a
authored
Nis 03, 1998
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Logical markup.
üst
9fee071a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
56 deletions
+60
-56
libthread.tex
Doc/lib/libthread.tex
+30
-28
libthread.tex
Doc/libthread.tex
+30
-28
No files found.
Doc/lib/libthread.tex
Dosyayı görüntüle @
d678cb7a
...
@@ -20,7 +20,6 @@ IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread
...
@@ -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).
...
@@ -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
...
@@ -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
...
@@ -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{
func
desc}
\end{
method
desc}
\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{
func
desc}
\end{
method
desc}
\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
}
e
quivalent to calling
\code
{
thread.
exit
_
thread()
}
.
e
xception 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 does
n'
t do any of its usual cleanup
When the main thread exits, it does
no
t 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}
Doc/libthread.tex
Dosyayı görüntüle @
d678cb7a
...
@@ -20,7 +20,6 @@ IRIX, Solaris 2.x, as well as on systems that have a \POSIX{} thread
...
@@ -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).
...
@@ -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
...
@@ -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
...
@@ -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{
func
desc}
\end{
method
desc}
\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{
func
desc}
\end{
method
desc}
\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
}
e
quivalent to calling
\code
{
thread.
exit
_
thread()
}
.
e
xception 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 does
n'
t do any of its usual cleanup
When the main thread exits, it does
no
t 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}
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