Commit Graph

81 Commits

Author SHA1 Message Date
Andrius Bentkus
c5101ae9b5 unix, windows: add common uv_udp_* error checking 2013-02-26 16:57:20 +01:00
Bert Belder
149b16f123 windows: closing handles should always keep the loop alive
This makes the tcp-ref2 and udp-ref2 tests pass again.
Also adds another reference count test.
2012-10-25 15:10:29 +02:00
saghul
61ecb3415d win: support compilation with Visual Studio 2008 2012-10-23 22:55:25 +02:00
Bert Belder
637be161b3 windows: make active and closing handle state independent 2012-08-27 23:56:35 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
cc7c8542a5 unix, windows: add stat() based file watcher
Monitors a file path for changes. Supersedes ev_stat.
2012-05-31 20:32:24 +02:00
Ben Noordhuis
95e89c6a0e unix, windows: share uv__handle_init() 2012-06-13 01:28:58 +02:00
Bert Belder
ed30365f54 uv-common: define INLINE macro 2012-06-02 23:06:43 +02:00
Ben Noordhuis
171ad8567d unix, windows: add uv_walk()
Lets the libuv user iterate over the open handles. Mostly intended as a
debugging tool or a post-hoc cleanup mechanism.
2012-05-30 02:33:39 +02:00
Ben Noordhuis
9d26f49725 unix, windows: rename flags UV__ACTIVE, UV__REF
Rename UV__ACTIVE and UV__REF to UV__HANDLE_ACTIVE and UV__HANDLE_REF to make
it clear that they apply to handles, not requests or loops.
2012-05-30 01:30:24 +02:00
Bert Belder
e4f23aacec Get rid of UV_LEAN_AND_MEAN 2012-05-28 01:53:22 +02:00
Ben Noordhuis
2ec09862e4 unix, windows: set active flag on unref'd handles
A logic bug in uv__handle_start() and uv__handle_stop() stopped the active flag
from getting set (or unset) on unref'd handles.
2012-05-28 00:24:39 +02:00
Bert Belder
58ba2d86e1 Move shared c-ares glue code from uv-common to cares.c 2012-05-22 16:11:23 +02:00
Bert Belder
c06edd4c88 windows, unix: share c-ares glue code 2012-05-22 16:11:22 +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
42095c85a0 Remove UV_ARES_TASK_PRIVATE_FIELDS.
It's only used internally, it doesn't have to be part of a public header file.
2012-04-03 02:44:50 +02:00
Ben Noordhuis
dfda5009c2 unix, win: store ares handles in a binary tree
Store the uv_ares_task_t handles in a red-black tree, not a linked list.

Fixes #72.
2012-03-16 00:49:29 +01:00
Ben Noordhuis
09c722e72b common: make uv__set_*_error() return -1
So you can do `if (errno) return uv__set_sys_error(loop, errno);`.
2012-02-23 05:57:36 -08:00
Ben Noordhuis
fbbc085448 Rename COUNTOF() to ARRAY_SIZE().
Consistent with Node, it has an ARRAY_SIZE() macro but not COUNTOF().
2012-01-18 15:48:31 +01:00
Ryan Dahl
b7da0a69bf Add uv__new_artificial_error() 2011-11-08 15:11:16 -08:00
Igor Zinkovsky
74b49e821b uv_kill 2011-11-02 14:34:07 -07:00
Bert Belder
c985ea4b10 Add uv__new_sys_error 2011-10-29 00:52:33 +02:00
Erick Tryzelaar
4c329060ca unix,win: Start unifying shared bind code. 2011-10-04 16:46:39 -07:00
Erick Tryzelaar
85368e8d45 unix,win: Start unifying shared tcp connect code. 2011-10-04 16:46:39 -07:00
Erick Tryzelaar
23796d208c Fixes #76. Unify OS error reporting
As a nice fringe benefit, this also shaves a word
off of a windows TCP handle by replacing "uv_err_t
bind_error" with "int bind_error".
2011-09-27 19:05:33 -07:00
Igor Zinkovsky
cfa1423f96 fix fs_file_noent on windows 2011-09-08 18:23:19 -07:00
Bert Belder
58ef43eee7 win: use win32 api for file reading and writing 2011-09-06 00:45:56 +02:00
Ryan Dahl
56dcaf9b06 unix: multiplicity 2011-08-31 04:18:55 +02:00
Ryan Dahl
3be275bad7 Begin implementation of UNIX uv_fs_ functions
Adding this incomplete work now to ease rebase troubles later as it moves
the functions to src/unix/fs.c and introduces src/unix/internal.h.
2011-08-29 14:36:45 -07:00
Igor Zinkovsky
f5ff869488 allocate windows pipe handles on demand 2011-07-13 20:43:10 -07:00
Ryan Dahl
ce8ff3031c src/ and include/ directories
Helps #71 but does not update the MSVC files.
2011-07-07 07:52:57 -07:00