@@ -479,21 +479,19 @@ non-pthreads build, the address space of the WebAssembly module is not shared,
479479so it is impossible for any thread capable of seeing an interrupt to write to
480480the eval breaker while the Python interpreter is running code. To work around
481481this, there are two possible solutions:
482-
483482* If Emscripten is run in a webworker and served with the shared memory headers,
484- it is possible to use shared memory outside of the WebAssembly address space
485- as a signal buffer. A signal handling UI thread can write the desired signal
486- into the signal buffer. The interpreter can periodically check the state of
487- this signal buffer in the eval breaker code. Checking the signal buffer is
488- slow compared to checking the eval breaker in native platforms, so we do only
489- do it once every 50 times through the eval breaker. See
490- `Python/emscripten_signal.c <https://github.com/python/cpython/blob/2bef8ea8ea045d20394f0daec7a5c5b1046a4e22/Python/emscripten_signal.c >`__
491-
483+ it is possible to use shared memory outside of the WebAssembly address space
484+ as a signal buffer. A signal handling UI thread can write the desired signal
485+ into the signal buffer. The interpreter can periodically check the state of
486+ this signal buffer in the eval breaker code. Checking the signal buffer is
487+ slow compared to checking the eval breaker in native platforms, so we do only
488+ do it once every 50 times through the eval breaker. See
489+ `Python/emscripten_signal.c <https://github.com/python/cpython/blob/2bef8ea8ea045d20394f0daec7a5c5b1046a4e22/Python/emscripten_signal.c >`__
492490* Using stack switching, we can occasionally switch the stack and allow the
493- JavaScript event loop to go around, then check the state of a signal buffer.
494- This requires the experimental JavaScript Promise Integration API, and would
495- be best used with the techniques for optimizing long tasks described
496- `in this article <https://web.dev/articles/optimize-long-tasks >`__
491+ JavaScript event loop to go around, then check the state of a signal buffer.
492+ This requires the experimental JavaScript Promise Integration API, and would
493+ be best used with the techniques for optimizing long tasks described
494+ `in this article <https://web.dev/articles/optimize-long-tasks >`__
497495
498496Emscripten Python has already implemented the solution based on shared memory,
499497and it is in use in Pyodide.
0 commit comments