I found that the signal mechanism used for inter-process communication in Node.js is very similar to the event mechanism (see the code example below). Is there any reason behind this? Or a design pattern?
signal
child.kill('SIGUSR1');
process.on('SIGUSR1', function () {
console.log('Got a SIGUSR1 signal.');
})
event
eventEmitter.emit('event')
eventEmitter.on('event', function () {
console.log('Trigger an event.');
})
Essentially they are message mechanisms, which is a programming idiom.