Issue #23708: select.devpoll now retries its internal write() when interrupted

by a signal (EINTR).

Modify devpoll_flush() to use _Py_write() instead of calling directly write().
This commit is contained in:
Victor Stinner 2015-03-19 23:33:09 +01:00
parent c7cd12da60
commit 54799672da
1 changed files with 3 additions and 7 deletions

View File

@ -718,14 +718,10 @@ static int devpoll_flush(devpollObject *self)
size = sizeof(struct pollfd)*self->n_fds; size = sizeof(struct pollfd)*self->n_fds;
self->n_fds = 0; self->n_fds = 0;
Py_BEGIN_ALLOW_THREADS n = _Py_write(self->fd_devpoll, self->fds, size);
n = write(self->fd_devpoll, self->fds, size); if (n == -1)
Py_END_ALLOW_THREADS
if (n == -1 ) {
PyErr_SetFromErrno(PyExc_IOError);
return -1; return -1;
}
if (n < size) { if (n < size) {
/* /*
** Data writed to /dev/poll is a binary data structure. It is not ** Data writed to /dev/poll is a binary data structure. It is not