Skip to content

Commit c0b7882

Browse files
committed
Revert unnecessary changes
1 parent 59aac0a commit c0b7882

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

system/lib/libc/musl/src/thread/__timedwait.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,18 @@ static int __futex4_cp(volatile void *addr, int op, int val, const struct timesp
3232
if (r != -ENOSYS) return r;
3333
return __syscall_cp(SYS_futex, addr, op & ~FUTEX_PRIVATE, val, to);
3434
}
35+
#endif
3536

3637
static volatile int dummy = 0;
3738
weak_alias(dummy, __eintr_valid_flag);
38-
#endif
3939

4040
int __timedwait_cp(volatile int *addr, int val,
4141
clockid_t clk, const struct timespec *at, int priv)
4242
{
4343
int r;
4444
struct timespec to, *top=0;
4545

46-
#ifndef __EMSCRIPTEN__
4746
if (priv) priv = FUTEX_PRIVATE;
48-
#endif
4947

5048
if (at) {
5149
if (at->tv_nsec >= 1000000000UL) return EINVAL;
@@ -58,9 +56,10 @@ int __timedwait_cp(volatile int *addr, int val,
5856
if (to.tv_sec < 0) return ETIMEDOUT;
5957
top = &to;
6058
}
59+
6160
#ifdef __EMSCRIPTEN__
6261
pthread_t self = __pthread_self();
63-
double msecsToSleep = top ? (top->tv_sec * 1000.0 + top->tv_nsec / 1000000.0) : INFINITY;
62+
double msecsToSleep = top ? (top->tv_sec * 1000 + top->tv_nsec / 1000000.0) : INFINITY;
6463
const int is_runtime_thread = emscripten_is_main_runtime_thread();
6564

6665
// Main runtime thread may need to run proxied calls, so sleep in very small slices to be responsive.
@@ -94,13 +93,11 @@ int __timedwait_cp(volatile int *addr, int val,
9493
r = -__futex4_cp(addr, FUTEX_WAIT|priv, val, top);
9594
#endif
9695
if (r != EINTR && r != ETIMEDOUT && r != ECANCELED) r = 0;
97-
#ifndef __EMSCRIPTEN__ // XXX Emscripten revert musl commit a63c0104e496f7ba78b64be3cd299b41e8cd427f
9896
/* Mitigate bug in old kernels wrongly reporting EINTR for non-
9997
* interrupting (SA_RESTART) signal handlers. This is only practical
10098
* when NO interrupting signal handlers have been installed, and
10199
* works by sigaction tracking whether that's the case. */
102100
if (r == EINTR && !__eintr_valid_flag) r = 0;
103-
#endif
104101

105102
return r;
106103
}

system/lib/libc/musl/src/thread/__wait.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
void __wait(volatile int *addr, volatile int *waiters, int val, int priv)
99
{
1010
int spins=100;
11-
#ifndef __EMSCRIPTEN__
1211
if (priv) priv = FUTEX_PRIVATE;
13-
#endif
1412
while (spins-- && (!waiters || !*waiters)) {
1513
if (*addr==val) a_spin();
1614
else return;

0 commit comments

Comments
 (0)