chore: update libuv patch for event loop integration (#31647)

* chore: update libuv patch for loop integration

* chore: update patches

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
This commit is contained in:
Cheng Zhao 2022-03-29 19:03:07 +09:00 committed by GitHub
parent 6b66fea67d
commit 4e66b072da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 509 additions and 94 deletions

View file

@ -322,6 +322,9 @@ NodeBindings::NodeBindings(BrowserEnvironment browser_env)
} else {
uv_loop_ = uv_default_loop();
}
// Interrupt embed polling when a handle is started.
uv_loop_configure(uv_loop_, UV_LOOP_INTERRUPT_ON_IO_CHANGE);
}
NodeBindings::~NodeBindings() {

View file

@ -38,22 +38,9 @@ void NodeBindingsLinux::RunMessageLoop() {
handle_ = handle;
// Get notified when libuv's watcher queue changes.
uv_loop_->data = this;
uv_loop_->on_watcher_queue_updated = OnWatcherQueueChanged;
NodeBindings::RunMessageLoop();
}
// static
void NodeBindingsLinux::OnWatcherQueueChanged(uv_loop_t* loop) {
NodeBindingsLinux* self = static_cast<NodeBindingsLinux*>(loop->data);
// We need to break the io polling in the epoll thread when loop's watcher
// queue changes, otherwise new events cannot be notified.
self->WakeupEmbedThread();
}
void NodeBindingsLinux::PollEvents() {
int timeout = uv_backend_timeout(uv_loop_);

View file

@ -19,9 +19,6 @@ class NodeBindingsLinux : public NodeBindings {
void RunMessageLoop() override;
private:
// Called when uv's watcher queue changes.
static void OnWatcherQueueChanged(uv_loop_t* loop);
void PollEvents() override;
// Epoll to poll for uv's backend fd.

View file

@ -38,22 +38,9 @@ void NodeBindingsMac::RunMessageLoop() {
handle_ = handle;
// Get notified when libuv's watcher queue changes.
uv_loop_->data = this;
uv_loop_->on_watcher_queue_updated = OnWatcherQueueChanged;
NodeBindings::RunMessageLoop();
}
// static
void NodeBindingsMac::OnWatcherQueueChanged(uv_loop_t* loop) {
NodeBindingsMac* self = static_cast<NodeBindingsMac*>(loop->data);
// We need to break the io polling in the kqueue thread when loop's watcher
// queue changes, otherwise new events cannot be notified.
self->WakeupEmbedThread();
}
void NodeBindingsMac::PollEvents() {
struct timeval tv;
int timeout = uv_backend_timeout(uv_loop_);

View file

@ -19,9 +19,6 @@ class NodeBindingsMac : public NodeBindings {
void RunMessageLoop() override;
private:
// Called when uv's watcher queue changes.
static void OnWatcherQueueChanged(uv_loop_t* loop);
void PollEvents() override;
// uv's backend fd.