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
f86e8ef3
Kaydet (Commit)
f86e8ef3
authored
Kas 22, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Patch #550765: Add daemon_threads flag.
üst
e0273de4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
libsocksvr.tex
Doc/lib/libsocksvr.tex
+8
-0
SocketServer.py
Lib/SocketServer.py
+8
-1
NEWS
Misc/NEWS
+6
-0
No files found.
Doc/lib/libsocksvr.tex
Dosyayı görüntüle @
f86e8ef3
...
@@ -37,6 +37,14 @@ handler class. Finally, call the \method{handle_request()} or
...
@@ -37,6 +37,14 @@ handler class. Finally, call the \method{handle_request()} or
\method
{
serve
_
forever()
}
method of the server object to process one or
\method
{
serve
_
forever()
}
method of the server object to process one or
many requests.
many requests.
When inheriting from
\class
{
ThreadingMixIn
}
for threaded connection
behavior, you should explicitly declare how you want your threads
to behave on an abrupt shutdown. The
\class
{
ThreadingMixIn
}
class
defines an attribute
\var
{
daemon
_
threads
}
, which indicates whether
or not the server should wait for thread termination. You should
set the flag explicitly if you would like threads to behave
autonomously.
Server classes have the same external methods and attributes, no
Server classes have the same external methods and attributes, no
matter what network protocol they use:
matter what network protocol they use:
...
...
Lib/SocketServer.py
Dosyayı görüntüle @
f86e8ef3
...
@@ -56,7 +56,8 @@ instance, a threading UDP server class is created as follows:
...
@@ -56,7 +56,8 @@ instance, a threading UDP server class is created as follows:
class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass
The Mix-in class must come first, since it overrides a method defined
The Mix-in class must come first, since it overrides a method defined
in UDPServer!
in UDPServer! Setting the various member variables also changes
the behavior of the underlying server mechanism.
To implement a service, you must derive a class from
To implement a service, you must derive a class from
BaseRequestHandler and redefine its handle() method. You can then run
BaseRequestHandler and redefine its handle() method. You can then run
...
@@ -448,6 +449,10 @@ class ForkingMixIn:
...
@@ -448,6 +449,10 @@ class ForkingMixIn:
class
ThreadingMixIn
:
class
ThreadingMixIn
:
"""Mix-in class to handle each request in a new thread."""
"""Mix-in class to handle each request in a new thread."""
# Decides how threads will act upon termination of the
# main process
daemon_threads
=
0
def
process_request_thread
(
self
,
request
,
client_address
):
def
process_request_thread
(
self
,
request
,
client_address
):
"""Same as in BaseServer but as a thread.
"""Same as in BaseServer but as a thread.
...
@@ -466,6 +471,8 @@ class ThreadingMixIn:
...
@@ -466,6 +471,8 @@ class ThreadingMixIn:
import
threading
import
threading
t
=
threading
.
Thread
(
target
=
self
.
process_request_thread
,
t
=
threading
.
Thread
(
target
=
self
.
process_request_thread
,
args
=
(
request
,
client_address
))
args
=
(
request
,
client_address
))
if
self
.
daemon_threads
:
t
.
setDaemon
(
1
)
t
.
start
()
t
.
start
()
...
...
Misc/NEWS
Dosyayı görüntüle @
f86e8ef3
...
@@ -389,6 +389,12 @@ Extension modules
...
@@ -389,6 +389,12 @@ Extension modules
Library
Library
-------
-------
- When cancelling a server that implemented threading with a keyboard
interrupt, the server would shut down but not terminate (waiting on
client threads). A new member variable, daemon_threads, was added to
the ThreadingMixIn class in SocketServer.py to make it explicit that
this behavior needs to be controlled.
- A new module, optparse, provides a fancy alternative to getopt for
- A new module, optparse, provides a fancy alternative to getopt for
command line parsing. It is a slightly modified version of Greg
command line parsing. It is a slightly modified version of Greg
Ward'
s
Optik
package
.
Ward'
s
Optik
package
.
...
...
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