Skip to content

Commit

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

    unix: consolidate rwlock tryrdlock trywrlock errors

    Fold EAGAIN and EBUSY into EBUSY. This makes it consistent across all
    Unix platforms and Windows.

    Refs: libuv/libuv#525
    PR-URL: libuv/libuv#535
    Reviewed-By: Ben Noordhuis <[email protected]>

PR-URL: nodejs-private/node-private#54
Reviewed-By: Saúl Ibarra Corretgé <[email protected]>
  • Loading branch information
rvagg committed Jun 23, 2016
1 parent 9627f34 commit 9207a00
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions deps/uv/src/unix/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) {
int err;

err = pthread_rwlock_tryrdlock(rwlock);
if (err && err != EBUSY && err != EAGAIN)
abort();
if (err) {
if (err != EBUSY && err != EAGAIN)
abort();
return -EBUSY;
}

return -err;
return 0;
}


Expand All @@ -185,10 +188,13 @@ int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) {
int err;

err = pthread_rwlock_trywrlock(rwlock);
if (err && err != EBUSY && err != EAGAIN)
abort();
if (err) {
if (err != EBUSY && err != EAGAIN)
abort();
return -EBUSY;
}

return -err;
return 0;
}


Expand Down

0 comments on commit 9207a00

Please sign in to comment.