This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Upgrade libuv to fce90652ed38ab0925131ed141972354a494933b

  • Loading branch information...
piscisaureus committed Nov 29, 2011
1 parent aab958b commit 6ed721afd2a85305eb69a3c727e64848c99c76e1
Showing with 20 additions and 30 deletions.
  1. +6 −8 deps/uv/src/win/core.c
  2. +14 −22 deps/uv/src/win/req.c
View
@@ -204,21 +204,19 @@ static void uv_poll_ex(uv_loop_t* loop, int block) {
uv_idle_invoke((loop)); \
} \
\
- /* Completely flush all pending reqs and endgames. */ \
- /* We do even when we just called the idle callbacks because those may */ \
- /* have closed handles or started requests that short-circuited. */ \
- while ((loop)->pending_reqs_tail || (loop)->endgame_handles) { \
- uv_process_endgames((loop)); \
- uv_process_reqs((loop)); \
- } \
+ uv_process_reqs((loop)); \
+ uv_process_endgames((loop)); \
\
if ((loop)->refs <= 0) { \
break; \
} \
\
uv_prepare_invoke((loop)); \
\
- poll((loop), (loop)->idle_handles == NULL && (loop)->refs > 0); \
+ poll((loop), (loop)->idle_handles == NULL && \
+ (loop)->pending_reqs_tail == NULL && \
+ (loop)->endgame_handles == NULL && \
+ (loop)->refs > 0); \
\
uv_check_invoke((loop)); \
}
View
@@ -51,27 +51,6 @@ void uv_insert_pending_req(uv_loop_t* loop, uv_req_t* req) {
}
-static uv_req_t* uv_remove_pending_req(uv_loop_t* loop) {
- uv_req_t* req;
-
- if (loop->pending_reqs_tail) {
- req = loop->pending_reqs_tail->next_req;
-
- if (req == loop->pending_reqs_tail) {
- loop->pending_reqs_tail = NULL;
- } else {
- loop->pending_reqs_tail->next_req = req->next_req;
- }
-
- return req;
-
- } else {
- /* queue empty */
- return NULL;
- }
-}
-
-
#define DELEGATE_STREAM_REQ(loop, req, method, handle_at) \
do { \
switch (((uv_handle_t*) (req)->handle_at)->type) { \
@@ -101,8 +80,21 @@ static uv_req_t* uv_remove_pending_req(uv_loop_t* loop) {
void uv_process_reqs(uv_loop_t* loop) {
uv_req_t* req;
+ uv_req_t* first;
+ uv_req_t* next;
+
+ if (loop->pending_reqs_tail == NULL) {
+ return;
+ }
+
+ first = loop->pending_reqs_tail->next_req;
+ next = first;
+ loop->pending_reqs_tail = NULL;
+
+ while (next != NULL) {
+ req = next;
+ next = req->next_req != first ? req->next_req : NULL;
- while (req = uv_remove_pending_req(loop)) {
switch (req->type) {
case UV_READ:
DELEGATE_STREAM_REQ(loop, req, read, data);

0 comments on commit 6ed721a

Please sign in to comment.