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
2c115faa
Commit
2c115faa
authored
Jun 30, 2004
by
Michael W. Hudson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check in the updated version of patch #957240, which doesn't rely
on the marshalling characteristics of infinities.
parent
9d8210a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
17 deletions
+24
-17
Doc/lib/libasyncore.tex
Doc/lib/libasyncore.tex
+14
-14
Lib/asyncore.py
Lib/asyncore.py
+10
-3
No files found.
Doc/lib/libasyncore.tex
View file @
2c115faa
...
@@ -44,20 +44,20 @@ channel (including any that have been added to the map during asynchronous
...
@@ -44,20 +44,20 @@ channel (including any that have been added to the map during asynchronous
service) is closed.
service) is closed.
\begin{funcdesc}
{
loop
}{
\optional
{
timeout
\optional
{
, use
_
poll
\optional
{
,
\begin{funcdesc}
{
loop
}{
\optional
{
timeout
\optional
{
, use
_
poll
\optional
{
,
map
}}}}
map
\optional
{
,count
}
}}}}
Enter a polling loop that
only terminates after all open channels
Enter a polling loop that
terminates after count passes or all open
have been closed. All arguments are optional. The
\var
{
timeout
}
channels have been closed. All arguments are optional. The
\var
(count)
argument sets the timeout parameter for the appropriate
parameter defaults to None, resulting in the loop terminating only
\function
{
select()
}
or
\function
{
poll()
}
call, measured in seconds;
when all channels have been closed. The
\var
{
timeout
}
argument sets the
t
he default is 30 seconds. The
\var
{
use
_
poll
}
parameter, if true,
t
imeout parameter for the appropriate
\function
{
select()
}
or
indicates that
\function
{
poll()
}
should be used in preference to
\function
{
poll()
}
call, measured in seconds; the default is 30 seconds.
\function
{
select()
}
(the default is
\code
{
False
}
). The
\var
{
map
}
parameter
The
\var
{
use
_
poll
}
parameter, if true, indicates that
\function
{
poll()
}
is a dictionary whose items are the channels to watch. As channel
s
should be used in preference to
\function
{
select()
}
(the default i
s
are closed they are deleted from their map. If
\var
{
map
}
is
\code
{
False
}
). The
\var
{
map
}
parameter is a dictionary whose items are
omitted, a global map is used (this map is updated by the default
the channels to watch. As channels are closed they are deleted from their
class
\method
{__
init
__
()
}
map. If
\var
{
map
}
is omitted, a global map is used (this map is updated
-- make sure you extend, rather than override,
\method
{__
init
__
()
}
by the default class
\method
{__
init
__
()
}
-- make sure you extend, rather
if you want to retain this behavior).
than override,
\method
{__
init
__
()
}
if you want to retain this behavior).
Channels (instances of
\class
{
asyncore.dispatcher
}
,
\class
{
asynchat.async
_
chat
}
Channels (instances of
\class
{
asyncore.dispatcher
}
,
\class
{
asynchat.async
_
chat
}
and subclasses thereof) can freely be mixed in the map.
and subclasses thereof) can freely be mixed in the map.
...
...
Lib/asyncore.py
View file @
2c115faa
...
@@ -157,7 +157,7 @@ def poll2(timeout=0.0, map=None):
...
@@ -157,7 +157,7 @@ def poll2(timeout=0.0, map=None):
poll3
=
poll2
# Alias for backward compatibility
poll3
=
poll2
# Alias for backward compatibility
def
loop
(
timeout
=
30.0
,
use_poll
=
False
,
map
=
None
):
def
loop
(
timeout
=
30.0
,
use_poll
=
False
,
map
=
None
,
count
=
None
):
if
map
is
None
:
if
map
is
None
:
map
=
socket_map
map
=
socket_map
...
@@ -166,8 +166,14 @@ def loop(timeout=30.0, use_poll=False, map=None):
...
@@ -166,8 +166,14 @@ def loop(timeout=30.0, use_poll=False, map=None):
else
:
else
:
poll_fun
=
poll
poll_fun
=
poll
while
map
:
if
count
is
None
:
poll_fun
(
timeout
,
map
)
while
map
:
poll_fun
(
timeout
,
map
)
else
:
while
map
and
count
>
0
:
poll_fun
(
timeout
,
map
)
count
=
count
-
1
class
dispatcher
:
class
dispatcher
:
...
@@ -523,3 +529,4 @@ if os.name == 'posix':
...
@@ -523,3 +529,4 @@ if os.name == 'posix':
self
.
_fileno
=
fd
self
.
_fileno
=
fd
self
.
socket
=
file_wrapper
(
fd
)
self
.
socket
=
file_wrapper
(
fd
)
self
.
add_channel
()
self
.
add_channel
()
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