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
ad1d5f90
Commit
ad1d5f90
authored
Jan 15, 2013
by
Richard Oudkerk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #10527: Use poll() instead of select() for multiprocessing pipes
parent
182d7cd5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/_multiprocessing/socket_connection.c
Modules/_multiprocessing/socket_connection.c
+33
-0
No files found.
Misc/NEWS
View file @
ad1d5f90
...
...
@@ -199,6 +199,8 @@ Core and Builtins
Library
-------
- Issue #10527: Use poll() instead of select() for multiprocessing pipes.
- Issue #9720: zipfile now writes correct local headers for files larger than
4 GiB.
...
...
Modules/_multiprocessing/socket_connection.c
View file @
ad1d5f90
...
...
@@ -8,6 +8,10 @@
#include "multiprocessing.h"
#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
# include "poll.h"
#endif
#ifdef MS_WINDOWS
# define WRITE(h, buffer, length) send((SOCKET)h, buffer, length, 0)
# define READ(h, buffer, length) recv((SOCKET)h, buffer, length, 0)
...
...
@@ -158,6 +162,34 @@ conn_recv_string(ConnectionObject *conn, char *buffer,
static
int
conn_poll
(
ConnectionObject
*
conn
,
double
timeout
,
PyThreadState
*
_save
)
{
#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)
int
res
;
struct
pollfd
p
;
p
.
fd
=
(
int
)
conn
->
handle
;
p
.
events
=
POLLIN
|
POLLPRI
;
p
.
revents
=
0
;
if
(
timeout
<
0
)
{
res
=
poll
(
&
p
,
1
,
-
1
);
}
else
{
res
=
poll
(
&
p
,
1
,
(
int
)(
timeout
*
1000
+
0
.
5
));
}
if
(
res
<
0
)
{
return
MP_SOCKET_ERROR
;
}
else
if
(
p
.
revents
&
(
POLLNVAL
|
POLLERR
))
{
Py_BLOCK_THREADS
PyErr_SetString
(
PyExc_IOError
,
"poll() gave POLLNVAL or POLLERR"
);
Py_UNBLOCK_THREADS
return
MP_EXCEPTION_HAS_BEEN_SET
;
}
else
if
(
p
.
revents
!=
0
)
{
return
TRUE
;
}
else
{
assert
(
res
==
0
);
return
FALSE
;
}
#else
int
res
;
fd_set
rfds
;
...
...
@@ -193,6 +225,7 @@ conn_poll(ConnectionObject *conn, double timeout, PyThreadState *_save)
assert
(
res
==
0
);
return
FALSE
;
}
#endif
}
/*
...
...
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