發(fā)現(xiàn)在 Node.js 中進程間通信使用的信號機制與事件機制十分相似(見下方代碼示例),這背后有什么道理嗎?或者一種設(shè)計模式?signalchild.kill('SIGUSR1');process.on('SIGUSR1', function () { console.log('Got a SIGUSR1 signal.');})eventeventEmitter.emit('event')eventEmitter.on('event', function () { console.log('Trigger an event.');})
Node.js 中的信號機制與事件機制? ???
米琪卡哇伊
2018-11-06 13:14:42
