Skip to content

Commit fc50a96

Browse files
authored
[libc] Move move_max_ms_slice_to_sleep variable. NFC (#26546)
1 parent d1f7fa6 commit fc50a96

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ int __timedwait_cp(volatile int *addr, int val,
6161
double msecsToSleep = top ? (top->tv_sec * 1000 + top->tv_nsec / 1000000.0) : INFINITY;
6262
int is_runtime_thread = emscripten_is_main_runtime_thread();
6363

64-
// Main runtime thread may need to run proxied calls, so sleep in very small slices to be responsive.
65-
double max_ms_slice_to_sleep = is_runtime_thread ? 1 : 100;
66-
6764
// cp suffix in the function name means "cancellation point", so this wait can be cancelled
6865
// by the users unless current threads cancelability is set to PTHREAD_CANCEL_DISABLE
6966
// which may be either done by the user of __timedwait() function.
7067
pthread_t self = pthread_self();
7168
if (is_runtime_thread ||
7269
self->canceldisable != PTHREAD_CANCEL_DISABLE ||
7370
self->cancelasync) {
71+
// Main runtime thread may need to run proxied calls, so sleep in very small slices to be responsive.
72+
double max_ms_slice_to_sleep = is_runtime_thread ? 1 : 100;
73+
7474
double sleepUntilTime = emscripten_get_now() + msecsToSleep;
7575
do {
7676
if (self->cancel) {

test/codesize/test_codesize_minimal_pthreads.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 7363,
33
"a.out.js.gz": 3604,
4-
"a.out.nodebug.wasm": 19259,
5-
"a.out.nodebug.wasm.gz": 8931,
6-
"total": 26622,
7-
"total_gz": 12535,
4+
"a.out.nodebug.wasm": 19256,
5+
"a.out.nodebug.wasm.gz": 8935,
6+
"total": 26619,
7+
"total_gz": 12539,
88
"sent": [
99
"a (memory)",
1010
"b (emscripten_get_now)",

test/codesize/test_codesize_minimal_pthreads_memgrowth.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"a.out.js": 7765,
33
"a.out.js.gz": 3810,
4-
"a.out.nodebug.wasm": 19260,
5-
"a.out.nodebug.wasm.gz": 8933,
6-
"total": 27025,
7-
"total_gz": 12743,
4+
"a.out.nodebug.wasm": 19257,
5+
"a.out.nodebug.wasm.gz": 8936,
6+
"total": 27022,
7+
"total_gz": 12746,
88
"sent": [
99
"a (memory)",
1010
"b (emscripten_get_now)",

0 commit comments

Comments
 (0)