Skip to content

Commit

Permalink
android: pthread_sigmask() does not set errno
Browse files Browse the repository at this point in the history
Originally intended workaround is especially needed for Android <4.4.
However it fails to compare errno collected from pthread_sigmask.

This has been fixed separately in JXcore. See issue:
jxcore/jxcore-cordova#55

PR-URL: libuv#833
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
obastemur authored and bnoordhuis committed Apr 15, 2016
1 parent 4a5b3f9 commit 70d5014
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/unix/pthread-fixes.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@

int uv__pthread_sigmask(int how, const sigset_t* set, sigset_t* oset) {
static int workaround;
int err;

if (workaround) {
return sigprocmask(how, set, oset);
} else if (pthread_sigmask(how, set, oset)) {
if (errno == EINVAL && sigprocmask(how, set, oset) == 0) {
workaround = 1;
return 0;
} else {
return -1;
}
} else {
return 0;
err = pthread_sigmask(how, set, oset);
if (err) {
if (err == EINVAL && sigprocmask(how, set, oset) == 0) {
workaround = 1;
return 0;
} else {
return -1;
}
}
}

return 0;
}

/*Android doesn't provide pthread_barrier_t for now.*/
Expand Down

0 comments on commit 70d5014

Please sign in to comment.