Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions system/lib/libc/musl/src/thread/__timedwait.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ int __timedwait_cp(volatile int *addr, int val,
double msecsToSleep = top ? (top->tv_sec * 1000 + top->tv_nsec / 1000000.0) : INFINITY;
int is_runtime_thread = emscripten_is_main_runtime_thread();

// Main runtime thread may need to run proxied calls, so sleep in very small slices to be responsive.
double max_ms_slice_to_sleep = is_runtime_thread ? 1 : 100;

// cp suffix in the function name means "cancellation point", so this wait can be cancelled
// by the users unless current threads cancelability is set to PTHREAD_CANCEL_DISABLE
// which may be either done by the user of __timedwait() function.
pthread_t self = pthread_self();
if (is_runtime_thread ||
self->canceldisable != PTHREAD_CANCEL_DISABLE ||
self->cancelasync) {
// Main runtime thread may need to run proxied calls, so sleep in very small slices to be responsive.
double max_ms_slice_to_sleep = is_runtime_thread ? 1 : 100;

double sleepUntilTime = emscripten_get_now() + msecsToSleep;
do {
if (self->cancel) {
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7363,
"a.out.js.gz": 3604,
"a.out.nodebug.wasm": 19259,
"a.out.nodebug.wasm.gz": 8931,
"total": 26622,
"total_gz": 12535,
"a.out.nodebug.wasm": 19256,
"a.out.nodebug.wasm.gz": 8935,
"total": 26619,
"total_gz": 12539,
"sent": [
"a (memory)",
"b (emscripten_get_now)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7765,
"a.out.js.gz": 3810,
"a.out.nodebug.wasm": 19260,
"a.out.nodebug.wasm.gz": 8933,
"total": 27025,
"total_gz": 12743,
"a.out.nodebug.wasm": 19257,
"a.out.nodebug.wasm.gz": 8936,
"total": 27022,
"total_gz": 12746,
"sent": [
"a (memory)",
"b (emscripten_get_now)",
Expand Down
Loading