joyent/libuv — pull request #935 by saghul (2013-09-23 23:33:50+00:00)
Title: unix, windows: add uv_fs_event_start/stop functions

Make uv_fs_event behave like other handles, that is, it's inactive after
init, and it's active between start and stop.

That.

I didn't add any new test (I plan to), but I'd like to get some feedback to see if I didn't fuck up anything too badly to begin with. Tests pass (I tested OSX, Linux and Windows).

The basic idea was to make init pretty dummy, put the meat of init now in start and what close did, do it in stop. But well, the devil is in the details :-)

Please review:

@bnoordhuis everything in general and nothing in particular :-)

@indutny please overview if the logic looks sound on OSX, where the fsevent thread is used

@piscisaureus my Windows-fu is not very strong, I'm trying! Please check if the stop process is done correctly, also the close. Basically I added some extra check not to fire any callback if there is an in-flight request when we called stop, in close use an endgame as usual. Also, I'm reusing handle->buffer until you close the handle, I hope that's ok.