Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
540276f3
Commit
540276f3
authored
Apr 25, 2018
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the libuv patch.
parent
6a3f198d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
10 additions
and
84 deletions
+10
-84
deps/README.rst
deps/README.rst
+0
-9
deps/gevent-libuv.patch
deps/gevent-libuv.patch
+0
-53
deps/libuv/include/uv-unix.h
deps/libuv/include/uv-unix.h
+0
-3
deps/libuv/src/unix/loop-watcher.c
deps/libuv/src/unix/loop-watcher.c
+3
-17
src/gevent/libuv/loop.py
src/gevent/libuv/loop.py
+7
-2
No files found.
deps/README.rst
View file @
540276f3
...
@@ -12,18 +12,9 @@
...
@@ -12,18 +12,9 @@
Updating libuv
Updating libuv
==============
==============
- Apply the gevent-libuv.patch to updates of libuv.
[deps] $ patch -p0 < gevent-libuv.patch
- Clean up the libuv tree:
- Clean up the libuv tree:
- rm -rf libuv/.github
- rm -rf libuv/.github
- rm -rf libuv/docs
- rm -rf libuv/docs
- rm -rf libuv/samples
- rm -rf libuv/samples
- rm -rf libuv/test
- rm -rf libuv/test
- rm -rf libuv/tools
- rm -rf libuv/tools
- Create new patches by downloading the source tarball:
[deps] $ tar -xf libuv-v1.20.1.tar.gz
[deps] $ diff -r -u libuv-v1.20.1/ libuv > gevent-libuv.patch
deps/gevent-libuv.patch
deleted
100644 → 0
View file @
6a3f198d
diff -r -u libuv-v1.20.1/include/uv-unix.h libuv/include/uv-unix.h
--- libuv-v1.20.1/include/uv-unix.h 2018-04-18 08:18:43.000000000 -0500
+++ libuv/include/uv-unix.h 2018-04-20 12:16:19.000000000 -0500
@@ -207,8 +207,11 @@
uv_handle_t* closing_handles; \
void* process_handles[2]; \
void* prepare_handles[2]; \
+ void* prepare_handles_queue[2]; \
void* check_handles[2]; \
+ void* check_handles_queue[2]; \
void* idle_handles[2]; \
+ void* idle_handles_queue[2]; \
void* async_handles[2]; \
void (*async_unused)(void); /* TODO(bnoordhuis) Remove in libuv v2. */ \
uv__io_t async_io_watcher; \
diff -r -u libuv-v1.20.1/src/unix/loop-watcher.c libuv/src/unix/loop-watcher.c
--- libuv-v1.20.1/src/unix/loop-watcher.c 2018-04-18 08:18:43.000000000 -0500
+++ libuv/src/unix/loop-watcher.c 2018-04-20 13:59:36.000000000 -0500
@@ -22,6 +22,20 @@
#include "uv.h"
#include "internal.h"
+/*
+ * gevent: Fix for https://github.com/gevent/gevent/issues/1126
+ *
+ * Using a stack-based queue variable in uv__run_* badly breaks for
+ * certain stack manipulations when greenlets switch. Windows keeps
+ * the stack in the loop. We originally used malloc/free in uv__run_
+ * to avoid changing any files but this one, but that benchmarked
+ * fairly slow and widely variable across processes
+ * (https://groups.google.com/d/msg/libuv/8BxOk40Dii4/Ke1yotOQBwAJ) so
+ * we moved them to the loop. We can't use global static variables
+ * because of multiple threads.
+ */
+#include <stdlib.h>
+
#define UV_LOOP_WATCHER_DEFINE(name, type) \
int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
uv__handle_init(loop, (uv_handle_t*)handle, UV_##type); \
@@ -47,10 +61,10 @@
\
void uv__run_##name(uv_loop_t* loop) { \
uv_##name##_t* h; \
- QUEUE queue; \
+ QUEUE* queue = &loop->name##_handles_queue; \
QUEUE* q; \
- QUEUE_MOVE(&loop->name##_handles, &queue); \
- while (!QUEUE_EMPTY(&queue)) { \
+ QUEUE_MOVE(&loop->name##_handles, queue); \
+ while (!QUEUE_EMPTY(queue)) { \
q = QUEUE_HEAD(&queue); \
h = QUEUE_DATA(q, uv_##name##_t, queue); \
QUEUE_REMOVE(q); \
deps/libuv/include/uv-unix.h
View file @
540276f3
...
@@ -207,11 +207,8 @@ typedef struct {
...
@@ -207,11 +207,8 @@ typedef struct {
uv_handle_t* closing_handles; \
uv_handle_t* closing_handles; \
void* process_handles[2]; \
void* process_handles[2]; \
void* prepare_handles[2]; \
void* prepare_handles[2]; \
void* prepare_handles_queue[2]; \
void* check_handles[2]; \
void* check_handles[2]; \
void* check_handles_queue[2]; \
void* idle_handles[2]; \
void* idle_handles[2]; \
void* idle_handles_queue[2]; \
void* async_handles[2]; \
void* async_handles[2]; \
void (*async_unused)(void);
/* TODO(bnoordhuis) Remove in libuv v2. */
\
void (*async_unused)(void);
/* TODO(bnoordhuis) Remove in libuv v2. */
\
uv__io_t async_io_watcher; \
uv__io_t async_io_watcher; \
...
...
deps/libuv/src/unix/loop-watcher.c
View file @
540276f3
...
@@ -22,20 +22,6 @@
...
@@ -22,20 +22,6 @@
#include "uv.h"
#include "uv.h"
#include "internal.h"
#include "internal.h"
/*
* gevent: Fix for https://github.com/gevent/gevent/issues/1126
*
* Using a stack-based queue variable in uv__run_* badly breaks for
* certain stack manipulations when greenlets switch. Windows keeps
* the stack in the loop. We originally used malloc/free in uv__run_
* to avoid changing any files but this one, but that benchmarked
* fairly slow and widely variable across processes
* (https://groups.google.com/d/msg/libuv/8BxOk40Dii4/Ke1yotOQBwAJ) so
* we moved them to the loop. We can't use global static variables
* because of multiple threads.
*/
#include <stdlib.h>
#define UV_LOOP_WATCHER_DEFINE(name, type) \
#define UV_LOOP_WATCHER_DEFINE(name, type) \
int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
int uv_##name##_init(uv_loop_t* loop, uv_##name##_t* handle) { \
uv__handle_init(loop, (uv_handle_t*)handle, UV_##type); \
uv__handle_init(loop, (uv_handle_t*)handle, UV_##type); \
...
@@ -61,10 +47,10 @@
...
@@ -61,10 +47,10 @@
\
\
void uv__run_##name(uv_loop_t* loop) { \
void uv__run_##name(uv_loop_t* loop) { \
uv_##name##_t* h; \
uv_##name##_t* h; \
QUEUE
* queue = &loop->name##_handles_queue;
\
QUEUE
queue;
\
QUEUE* q; \
QUEUE* q; \
QUEUE_MOVE(&loop->name##_handles,
queue);
\
QUEUE_MOVE(&loop->name##_handles,
&queue);
\
while (!QUEUE_EMPTY(
queue)) {
\
while (!QUEUE_EMPTY(
&queue)) {
\
q = QUEUE_HEAD(&queue); \
q = QUEUE_HEAD(&queue); \
h = QUEUE_DATA(q, uv_##name##_t, queue); \
h = QUEUE_DATA(q, uv_##name##_t, queue); \
QUEUE_REMOVE(q); \
QUEUE_REMOVE(q); \
...
...
src/gevent/libuv/loop.py
View file @
540276f3
...
@@ -404,6 +404,10 @@ class loop(AbstractLoop):
...
@@ -404,6 +404,10 @@ class loop(AbstractLoop):
self
.
_queued_callbacks
=
[]
self
.
_queued_callbacks
=
[]
for
watcher_ptr
,
arg
in
cbs
:
for
watcher_ptr
,
arg
in
cbs
:
handle
=
watcher_ptr
.
data
handle
=
watcher_ptr
.
data
if
not
handle
:
# It's been stopped and possibly closed
assert
not
libuv
.
uv_is_active
(
watcher_ptr
)
continue
val
=
_callbacks
.
python_callback
(
handle
,
arg
)
val
=
_callbacks
.
python_callback
(
handle
,
arg
)
if
val
==
-
1
:
if
val
==
-
1
:
_callbacks
.
python_handle_error
(
handle
,
arg
)
_callbacks
.
python_handle_error
(
handle
,
arg
)
...
@@ -428,9 +432,10 @@ class loop(AbstractLoop):
...
@@ -428,9 +432,10 @@ class loop(AbstractLoop):
if
mode
==
libuv
.
UV_RUN_DEFAULT
:
if
mode
==
libuv
.
UV_RUN_DEFAULT
:
while
self
.
_ptr
:
while
self
.
_ptr
:
#print('Looping in python', self._ptr)
ran_status
=
libuv
.
uv_run
(
self
.
_ptr
,
libuv
.
UV_RUN_ONCE
)
ran_status
=
libuv
.
uv_run
(
self
.
_ptr
,
libuv
.
UV_RUN_ONCE
)
#print("Looped in python", ran_status, self._queued_callbacks)
# XXX: This approach runs timer and prepare handles *after* polling for
# I/O is done. That's really not ideal, although it doesn't cause any test failures.
# Perhaps we need to implement those type of watchers directly in Python?
ran_callbacks
=
self
.
__run_queued_callbacks
()
ran_callbacks
=
self
.
__run_queued_callbacks
()
if
not
ran_status
and
not
ran_callbacks
:
if
not
ran_status
and
not
ran_callbacks
:
# A return of 0 means there are no referenced and
# A return of 0 means there are no referenced and
...
...
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