[WIP] Implement Pthread Manager Worker for synchronous thread creation#26979
[WIP] Implement Pthread Manager Worker for synchronous thread creation#26979sbc100 wants to merge 1 commit into
Conversation
|
Kind of an interesting approach that gemini took here, which is to create to have the pthread-manager running the same JS file. I think this has some advantages in that we can keep the worker spawning code in place where it can run both in manager and non-manager mode. I also like that avoids adding an additional file (e.g. The alternative would be to embed some kind of |
I don't think there is a web standard that guarantees this. It is arbitrary and unspecified whether a particular browser requires the calling Worker to periodically yield, or the main thread to periodically yield, in order to make progress on launching Workers. If we do have this guarantee, I think we should first probe the W3C people to ensure that this will be enforced, and that it does actually work out in practice today in all the browsers. |
a16181c to
856e7df
Compare
856e7df to
83e1d3a
Compare
[WIP] - Gemini Created initial PR
This change introduces a dedicated 'Pthread Manager' worker that acts as an intermediary for managing the lifecycle of pthread workers.
By moving the responsibility of spawning and managing workers to a dedicated manager worker, we enable synchronous pthread creation on the main browser thread even when it is blocked (e.g. during a join or futex wait). This is because the manager worker and its nested child workers can be started by the browser independently of the main thread's event loop.
Key changes:
Fixes: #18633