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
a6ebb2d7
Kaydet (Commit)
a6ebb2d7
authored
Ock 12, 2013
tarafından
Charles-François Natali
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #16876: Revert be8e6b81284e, which wasn't thread-safe: wait until a
solution is found for poll().
üst
e6f3d531
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
35 deletions
+13
-35
NEWS
Misc/NEWS
+0
-3
selectmodule.c
Modules/selectmodule.c
+13
-32
No files found.
Misc/NEWS
Dosyayı görüntüle @
a6ebb2d7
...
...
@@ -233,9 +233,6 @@ Library
failing if the connection used a row factory (such as sqlite3.Row) that
produced unsortable objects. (Regression was introduced by fix for 9750).
- Issue #16876: Optimize epoll.poll() by keeping a per-instance epoll events
buffer instead of allocating a new one at each poll().
- Issue #16491: IDLE now prints chained exception tracebacks.
- fcntl: add F_DUPFD_CLOEXEC constant, available on Linux 2.6.24+.
...
...
Modules/selectmodule.c
Dosyayı görüntüle @
a6ebb2d7
...
...
@@ -1056,14 +1056,9 @@ static int select_have_broken_poll(void)
#include <sys/epoll.h>
#endif
/* default maximum number of events returned by epoll_wait() */
#define EPOLL_DEFAULT_MAXEVENTS (FD_SETSIZE)
typedef
struct
{
PyObject_HEAD
SOCKET
epfd
;
/* epoll control file descriptor */
int
maxevents
;
/* maximum number of epoll events */
struct
epoll_event
*
evs
;
/* epoll events buffer */
SOCKET
epfd
;
/* epoll control file descriptor */
}
pyEpoll_Object
;
static
PyTypeObject
pyEpoll_Type
;
...
...
@@ -1119,15 +1114,6 @@ newPyEpoll_Object(PyTypeObject *type, int sizehint, int flags, SOCKET fd)
PyErr_SetFromErrno
(
PyExc_OSError
);
return
NULL
;
}
self
->
maxevents
=
EPOLL_DEFAULT_MAXEVENTS
;
self
->
evs
=
PyMem_New
(
struct
epoll_event
,
self
->
maxevents
);
if
(
!
self
->
evs
)
{
Py_DECREF
(
self
);
PyErr_NoMemory
();
return
NULL
;
}
return
(
PyObject
*
)
self
;
}
...
...
@@ -1154,10 +1140,6 @@ static void
pyepoll_dealloc
(
pyEpoll_Object
*
self
)
{
(
void
)
pyepoll_internal_close
(
self
);
if
(
self
->
evs
)
{
PyMem_Free
(
self
->
evs
);
self
->
evs
=
NULL
;
}
Py_TYPE
(
self
)
->
tp_free
(
self
);
}
...
...
@@ -1338,6 +1320,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
int
maxevents
=
-
1
;
int
nfds
,
i
;
PyObject
*
elist
=
NULL
,
*
etuple
=
NULL
;
struct
epoll_event
*
evs
=
NULL
;
static
char
*
kwlist
[]
=
{
"timeout"
,
"maxevents"
,
NULL
};
if
(
self
->
epfd
<
0
)
...
...
@@ -1361,27 +1344,24 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
}
if
(
maxevents
==
-
1
)
{
maxevents
=
EPOLL_DEFAULT_MAXEVENTS
;
}
else
if
(
maxevents
<
1
)
{
maxevents
=
FD_SETSIZE
-
1
;
}
else
if
(
maxevents
<
1
)
{
PyErr_Format
(
PyExc_ValueError
,
"maxevents must be greater than 0, got %d"
,
maxevents
);
return
NULL
;
}
if
(
maxevents
>
self
->
maxevents
)
{
struct
epoll_event
*
orig_evs
=
self
->
evs
;
PyMem_RESIZE
(
self
->
evs
,
struct
epoll_event
,
maxevents
);
if
(
!
self
->
evs
)
{
self
->
evs
=
orig_evs
;
PyErr_NoMemory
();
return
NULL
;
}
self
->
maxevents
=
maxevents
;
evs
=
PyMem_New
(
struct
epoll_event
,
maxevents
);
if
(
evs
==
NULL
)
{
Py_DECREF
(
self
);
PyErr_NoMemory
();
return
NULL
;
}
Py_BEGIN_ALLOW_THREADS
nfds
=
epoll_wait
(
self
->
epfd
,
self
->
evs
,
self
->
maxevents
,
timeout
);
nfds
=
epoll_wait
(
self
->
epfd
,
evs
,
maxevents
,
timeout
);
Py_END_ALLOW_THREADS
if
(
nfds
<
0
)
{
PyErr_SetFromErrno
(
PyExc_OSError
);
...
...
@@ -1394,7 +1374,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
}
for
(
i
=
0
;
i
<
nfds
;
i
++
)
{
etuple
=
Py_BuildValue
(
"iI"
,
self
->
evs
[
i
].
data
.
fd
,
self
->
evs
[
i
].
events
);
etuple
=
Py_BuildValue
(
"iI"
,
evs
[
i
].
data
.
fd
,
evs
[
i
].
events
);
if
(
etuple
==
NULL
)
{
Py_CLEAR
(
elist
);
goto
error
;
...
...
@@ -1403,6 +1383,7 @@ pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds)
}
error:
PyMem_Free
(
evs
);
return
elist
;
}
...
...
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