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:
parent
c89df5b990
commit
4c87666a93
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user