All uses of ngx_queue_split in libuv split the list at the head so
introduce a ngx_queue_move macro that automates that.
This is a backport of commit 1867a6c from the v1.x branch.
PR-URL: https://github.com/libuv/libuv/pull/566
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Wake up the event loop with uv_async_send() when a request is cancelled.
Ensures the done_cb is run on the next tick of the event loop.
Not sending a wakeup signal results in the done_cb not getting called until
another request completes, which may be a long time coming when it's the only
request in the queue or when other requests are executing long-running jobs.
Fixes#669.
Bert Belder informs me the current approach where a request is immediately
cancelled, is impossible to implement on Windows.
Rework the API to always invoke the "done" callback with an UV_ECANCELED error
code.
Send the wakeup signal to the main thread *before* releasing the lock. Doing it
the other way around introduces a race condition where the watcher may already
have been pulled off the work queue.
Fixes a segmentation fault on 32 bits linux with glibc 2.15.
Thanks to Johan Bergström (@jbergstroem) for reporting the issue and testing
out the patch.