Remove some of the complexity from __timedwait.c. NFC#26511
Remove some of the complexity from __timedwait.c. NFC#26511sbc100 merged 1 commit intoemscripten-core:mainfrom
Conversation
|
What gemini had to say about this change: ✦ I have reviewed your proposed changes at HEAD. The changes in system/lib/libc/musl/src/thread/__timedwait.c appear to be a sound cleanup and Key Observations:
Minor Considerations:
Overall, the change looks excellent and improves both the code quality and size without regressing functionality. |
|
So on the main thread, does this mean that timedwait will slice the sleep to 100ms and futex may slice to 1ms (or 100ms) also? |
Yes I believe if you enter In addition, if you are the main runtime thread the futex_wait will then slice that 100ms into 1ms slices. |
905d8d4 to
0fbb41a
Compare
This should have been part of emscripten-core#26471. The breaking up of the wait time for 2 of the 3 cases that are handled here is now handled one layer own in emscripten_futex_wait: 1. Breaking up the wait because we are the main runtime thread. 2. Breaking up the wait because we are async cancelable. The third cases here (breaking up the wait because we are cancelable in the non-async sense) still needs to be handled here at the higher level.
|
OK, I think this change is good to go now. I think we could further simplify once this change lands. |
| double max_ms_slice_to_sleep = is_runtime_thread ? 1 : 100; | ||
|
|
||
| if (self->canceldisable != PTHREAD_CANCEL_DISABLE) { | ||
| double max_ms_slice_to_sleep = 100; |
There was a problem hiding this comment.
| double max_ms_slice_to_sleep = 100; | |
| const double max_ms_slice_to_sleep = 100; |
This removes the timeout slicing from `__timedwait` and instead relies on the existing slicing in `emscripten_futex_wait.c`. This is a followup to emscripten-core#26511 and emscripten-core#26471 (which did the same for the slicing in `__wait`).
This removes the timeout slicing from `__timedwait` and instead relies on the existing slicing in `emscripten_futex_wait.c`. This is a followup to emscripten-core#26511 and emscripten-core#26471 (which did the same for the slicing in `__wait`).
This should have been part of #26471.
The breaking up of the wait time for 2 of the 3 cases that are handled here is now handled one layer down in
emscripten_futex_wait:The third cases here (breaking up the wait because we are cancelable in the non-async sense) still needs to be handled here at the higher level.