从预加载脚本启动工作线程
【Launching worker threads from preload scripts】
在从预加载脚本(使用 -r 命令行标志加载并运行的脚本)启动工作线程时要小心。除非明确设置了 execArgv 选项,否则新工作线程会自动继承运行进程的命令行标志,并会像主线程一样预加载相同的预加载脚本。如果预加载脚本无条件地启动工作线程,每个生成的线程都会产生另一个线程,直到应用崩溃。
【Take care when launching worker threads from preload scripts (scripts loaded
and run using the -r command line flag). Unless the execArgv option is
explicitly set, new Worker threads automatically inherit the command line flags
from the running process and will preload the same preload scripts as the main
thread. If the preload script unconditionally launches a worker thread, every
thread spawned will spawn another until the application crashes.】