* replace libev backed timers with a pure libuv implementation
* gut ev_run() and make it take a timeout instead of flags
Incidentally speeds up the loop_count_timed benchmark by about 100%.
Makes the uv__io code a little more obscure but has the advantage that
sizeof(uv__io_t) == sizeof(ev_io), i.e. the sizes of embedding handles
don't change.
The new idle watcher was temporarily disabled in 073a48d due to some semantic
incompatibilities with the previous implementation. This commit resolves those
issues and reactivates the new implementation.
One outstanding bug is that idle watchers can run in a different order
(relative to other handle types) than the old implementation, e.g. (timer, idle)
instead of the expected (idle, timer). This will be fixed in an upcoming commit.
This commit changes how the event loop determines if it needs to stay alive.
Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.
While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.
That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:
* timers: ticking
* sockets: reading, writing or listening
* processes: always active (for now, subject to change)
* idle, check, prepare: only active when started
This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.
The Windows implementation was done by Bert Belder.
Instead of using one port per watch, use one port for all the watches.
This is a cherry-pick of commit 7326962 from v0.6 into master.
Conflicts:
include/uv-private/uv-unix.h
src/unix/core.c
src/unix/sunos.c
Always compile in the kqueue-based fs event watcher and handle it at run-time
if the kernel doesn't actually support it.
Works around build issues when -mmacosx-version-min is not set properly.
Fixesjoyent/node#3075.
Remove the next_watcher and replace it with a linked list. Said list is named
endgame_handles (because the uv-win calls it that) and contains all the handles
that are in the UV_CLOSING state.
The goal of this commit is two-fold:
a) remove a dependency on libev, and
b) share more code with uv-win in the future
A nice side effect is that it shaves a few bytes off a uv_handle_t.
Previously, a new inotify fd was created for each watcher, making it quite easy
to run into the system-wide fs.inotify.max_user_instances limit (usually 128).
Fixes#300.
Not needed anymore now that support for isolates has been removed from Node.
This commit reverts the following commits:
812e410 test: fix up stream import/export test
e34dc13 unix: implement uv_import() and uv_export()
d1a0e8e test: fix undefined macro error
2ce0058 import/export streams accross loops
Read/write locks are emulated with critical sections on Windows XP and Vista
because those platforms don't have a (complete) native read/write lock API.
1. Ensure that failed writes don't leave the write queue in an inconsistent
state. Before, write requests were handed back to the user but were not
removed from the write queue. The cause of at least one use-after-free bug.
2. Pass the error to the callback on the next iteration of the event loop
instead of returning it immediately.