Fix flakes in runitd and popen_test

This commit is contained in:
Justine Tunney 2023-07-30 04:26:34 -07:00
parent 801224df67
commit 2ebc5781a1
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
18 changed files with 123 additions and 34 deletions

View file

@ -34,17 +34,27 @@
#include "libc/thread/tls.h"
textwindows int _check_interrupts(bool restartable, struct Fd *fd) {
int rc;
int e, rc;
e = errno;
if (_weaken(pthread_testcancel_np) &&
(rc = _weaken(pthread_testcancel_np)())) {
errno = rc;
return -1;
}
if (_weaken(_check_sigalrm)) _weaken(_check_sigalrm)();
if (!__tls_enabled || !(__get_tls()->tib_flags & TIB_FLAG_TIME_CRITICAL)) {
if (_weaken(_check_sigchld)) _weaken(_check_sigchld)();
if (fd && _weaken(_check_sigwinch)) _weaken(_check_sigwinch)(fd);
if (_weaken(_check_sigalrm)) {
_weaken(_check_sigalrm)();
}
if (_weaken(__sig_check) && _weaken(__sig_check)(restartable)) return eintr();
if (!__tls_enabled || !(__get_tls()->tib_flags & TIB_FLAG_TIME_CRITICAL)) {
if (_weaken(_check_sigchld)) {
_weaken(_check_sigchld)();
}
if (fd && _weaken(_check_sigwinch)) {
_weaken(_check_sigwinch)(fd);
}
}
if (_weaken(__sig_check) && _weaken(__sig_check)(restartable)) {
return eintr();
}
errno = e;
return 0;
}