src: experiment fix
This commit is contained in:
parent
fe32ad3b58
commit
1d9649b1ae
|
@ -67,7 +67,6 @@ struct uv_link_methods_s {
|
|||
int close_depth; \
|
||||
int close_waiting; \
|
||||
uv_link_close_cb saved_close_cb; \
|
||||
uv_link_close_cb pending_close_cb; \
|
||||
uv_link_t* pending_close_source;
|
||||
|
||||
struct uv_link_s {
|
||||
|
|
|
@ -85,28 +85,25 @@ void uv_link_close(uv_link_t* link, uv_link_close_cb cb) {
|
|||
}
|
||||
|
||||
|
||||
void uv_link_maybe_close(uv_link_t* link) {
|
||||
uv_link_close_cb cb;
|
||||
uv_link_t* source;
|
||||
|
||||
if (link->pending_close_cb == NULL)
|
||||
return;
|
||||
|
||||
cb = link->pending_close_cb;
|
||||
source = link->pending_close_source;
|
||||
|
||||
link->pending_close_cb = NULL;
|
||||
link->pending_close_source = NULL;
|
||||
return uv_link_propagate_close(link, source, cb);
|
||||
}
|
||||
|
||||
|
||||
static void uv_link_close_join(uv_link_t* link) {
|
||||
if (--link->close_waiting == 0)
|
||||
return link->saved_close_cb(link);
|
||||
}
|
||||
|
||||
|
||||
void uv_link_maybe_close(uv_link_t* link) {
|
||||
uv_link_t* source;
|
||||
|
||||
if (link->pending_close_source == NULL)
|
||||
return;
|
||||
|
||||
source = link->pending_close_source;
|
||||
|
||||
link->pending_close_source = NULL;
|
||||
link->methods->close(link, source, uv_link_close_join);
|
||||
}
|
||||
|
||||
|
||||
void uv_link_propagate_close(uv_link_t* link, uv_link_t* source,
|
||||
uv_link_close_cb cb) {
|
||||
uv_link_t* root;
|
||||
|
@ -134,12 +131,10 @@ void uv_link_propagate_close(uv_link_t* link, uv_link_t* source,
|
|||
if (child != NULL)
|
||||
CHECK_EQ(uv_link_unchain(root, child), 0, "close unchain");
|
||||
|
||||
if (root->close_depth == 0) {
|
||||
if (root->close_depth == 0)
|
||||
root->methods->close(root, source, uv_link_close_join);
|
||||
} else {
|
||||
root->pending_close_cb = uv_link_close_join;
|
||||
else
|
||||
root->pending_close_source = source;
|
||||
}
|
||||
root = child;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue