Skip to content

worker: refactor thread id management

  • Assign thread IDs to Environment instances, rather than Workers. This is more embedder-friendly than the current system, in which all “main threads” (if there are multiple ones) would get the id 0.
  • Because that means that isMainThread === (threadId === 0) no longer holds, refactor isMainThread into a separate entity. Implement it in a way that allows for future extensibility, because we use isMainThread in multiple different ways (determining whether there is a parent thread; determining whether the current thread has control of the current process; etc.).
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading