unix: speed up uv_async_send()

Don't make a syscall when the handle is already pending.

Speeds up the async_pummel benchmark by about 13%.
This commit is contained in:
Ben Noordhuis 2012-06-29 03:17:04 +02:00
parent c89df5b990
commit 4c87666a93

View File

@ -50,6 +50,9 @@ int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
int uv_async_send(uv_async_t* handle) {
int r;
if (handle->pending)
return 0;
handle->pending = 1; /* XXX needs a memory barrier? */
do