Commit Graph

58 Commits

Author SHA1 Message Date
Ben Noordhuis
80b554129b unix: reactive new idle watcher implementation
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.
2012-05-22 15:13:52 +02:00
Ben Noordhuis
073a48d6bf unix: back out new idle watcher for now
Its semantics don't quite match what node.js expects. This breaks the
stdio_over_pipes and shutdown_close_pipe tests but that can't be helped.
2012-05-18 01:19:56 +02:00
Ben Noordhuis
9efa8b3571 unix, windows: rework reference counting scheme
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.
2012-05-17 07:07:53 +02:00
Ben Noordhuis
b5f9bc861f sunos: make fs.watch scale better
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
2012-05-05 00:51:32 +00:00
Ben Noordhuis
6037684ef8 unix: zero out new loop struct
Fixes spurious segfaults in pyuv.
2012-05-04 15:02:33 +02:00
Ben Noordhuis
8e6f332fed unix: fix compiler warning, #include <unistd.h> 2012-04-06 01:24:20 +02:00
Ben Noordhuis
f4e7537184 unix: move inotify init logic to loop.c 2012-04-05 15:13:14 +02:00
Ben Noordhuis
68bed698fc unix: move loop init logic out of core.c 2012-04-04 05:54:39 -07:00