Skip to content

Commit

Permalink
deps: backport bd1777fd from libuv upstream
Browse files Browse the repository at this point in the history
Original commit message:

    unix, win: consolidate mutex trylock errors

    Fold EAGAIN into EBUSY, and make it the only acceptable error.

    PR-URL: libuv/libuv#535
    Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>

PR-URL: nodejs-private/node-private#54
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
  • Loading branch information
rvagg committed Jun 23, 2016
1 parent 9207a00 commit da8501e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions deps/uv/src/unix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ void uv_mutex_lock(uv_mutex_t* mutex) {
int uv_mutex_trylock(uv_mutex_t* mutex) {
int err;

/* FIXME(bnoordhuis) EAGAIN means recursive lock limit reached. Arguably
* a bug, should probably abort rather than return -EAGAIN.
*/
err = pthread_mutex_trylock(mutex);
if (err && err != EBUSY && err != EAGAIN)
abort();
if (err) {
if (err != EBUSY && err != EAGAIN)
abort();
return -EBUSY;
}

return -err;
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/win/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ int uv_mutex_trylock(uv_mutex_t* mutex) {
if (TryEnterCriticalSection(mutex))
return 0;
else
return UV_EAGAIN;
return UV_EBUSY;
}


Expand Down

0 comments on commit da8501e

Please sign in to comment.