worker.threadId


引用线程的整数标识符。 在工作线程内部,它作为 require('node:worker_threads').threadId 可用。 此值对于单个进程中的每个 Worker 实例都是唯一的。

An integer identifier for the referenced thread. Inside the worker thread, it is available as require('node:worker_threads').threadId. This value is unique for each Worker instance inside a single process.