Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
unix: fix uv_poll CPU usage spike
Saúl Ibarra Corretgé reports that calling uv_poll_start() repeatedly results
in CPU usage spikes. Fixed by stopping the poll I/O watcher before updating it.

Fixes #424.
  • Loading branch information
bnoordhuis committed May 23, 2012
1 parent b19a713 commit 2e3e658
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/unix/poll.c
Expand Up @@ -100,6 +100,7 @@ int uv_poll_start(uv_poll_t* handle, int pevents, uv_poll_cb poll_cb) {
if (pevents & UV_WRITABLE)
events |= UV__IO_WRITE;

uv__io_stop(handle->loop, &handle->io_watcher);
uv__io_set(&handle->io_watcher, uv__poll_io, handle->fd, events);
uv__io_start(handle->loop, &handle->io_watcher);

Expand Down

0 comments on commit 2e3e658

Please sign in to comment.