- Use atomic ops both to set and reset async_sent flag
- Remove the MinGW atomic ops, since Windows intrinsics are supported
- Remone thread-unsafe checks from uv_async_send
According to MSDN there are no alignment requirements. We could use
InterlockedExchange8, but that's only available on Windows >= 8.
This change is intended to make uv_async_send more resilient. It has to
be thread-safe, and that means that the handle could just have been
closed when uv_async_send was called. This case was previously not
handles (there is an inherent race condition). The new model is inspired
by the one used on the Unix side, which uses a single fd (or overlapped
in this case) to wakeup the loop and then process all pending async
handles. This makes handling those edge cases a lot simpler: when the
handle is closed it's removed from the handle queue, and then it's not
processed at all.
As a result of this change, async benchmarks work on Windows where they
previously failed with assertions.
PR-URL: https://github.com/libuv/libuv/pull/980
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>