Permalink
Browse files

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%.
  • Loading branch information...
1 parent c89df5b commit 4c87666a9363ab01010c426e1b7dfb432dec844e @bnoordhuis bnoordhuis committed Jun 29, 2012
Showing with 3 additions and 0 deletions.
  1. +3 −0 src/unix/async.c
View
@@ -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

0 comments on commit 4c87666

Please sign in to comment.