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 id0
. - Because that means that
isMainThread === (threadId === 0)
no longer holds, refactorisMainThread
into a separate entity. Implement it in a way that allows for future extensibility, because we useisMainThread
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), orvcbuild test
(Windows) passes -
commit message follows commit guidelines