所有的工作进程都是通过child_process.fork()来创建的,这个方法返回的对象被存储为.process。在工作进程中, process属于全局对象。

详见:Child Process module

需要注意:当process上发生 'disconnect'事件,并且.exitedAfterDisconnect的值不是true时,工作进程会调用 process.exit(0)。这样就可以防止连接意外断开。

All workers are created using child_process.fork(), the returned object from this function is stored as .process. In a worker, the global process is stored.

See: Child Process module.

Note that workers will call process.exit(0) if the 'disconnect' event occurs on process and .exitedAfterDisconnect is not true. This protects against accidental disconnection.