Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: speed up uv_async_send()
Browse files Browse the repository at this point in the history
Don't make a syscall when the handle is already pending.

Speeds up the async_pummel benchmark by about 13%.
  • Loading branch information
bnoordhuis committed Jun 29, 2012
1 parent c89df5b commit 4c87666
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unix/async.c
Expand Up @@ -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
Expand Down

0 comments on commit 4c87666

Please sign in to comment.