Unverified Commit 393c1966 authored by Anna Henningsen's avatar Anna Henningsen
Browse files

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.).

PR-URL: https://github.com/nodejs/node/pull/25796


Reviewed-By: default avatarJoyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: default avatarJames M Snell <jasnell@gmail.com>
Reviewed-By: default avatarBenjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: default avatarDenys Otrishko <shishugi@gmail.com>
parent bcf2886a
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment