mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
586 B
35 lines
586 B
15 years ago
|
process.mixin(require("../common"));
|
||
15 years ago
|
|
||
15 years ago
|
puts("process.pid: " + process.pid);
|
||
|
|
||
|
var first = 0,
|
||
|
second = 0;
|
||
|
|
||
|
process.addListener('SIGUSR1', function () {
|
||
|
puts("Interrupted by SIGUSR1");
|
||
|
first += 1;
|
||
|
});
|
||
|
|
||
|
process.addListener('SIGUSR1', function () {
|
||
|
second += 1;
|
||
|
setTimeout(function () {
|
||
|
puts("End.");
|
||
|
process.exit(0);
|
||
|
}, 5);
|
||
|
});
|
||
|
|
||
|
i = 0;
|
||
|
setInterval(function () {
|
||
|
puts("running process..." + ++i);
|
||
|
|
||
|
if (i == 5) {
|
||
15 years ago
|
process.kill(process.pid, "SIGUSR1");
|
||
15 years ago
|
}
|
||
|
}, 1);
|
||
|
|
||
|
|
||
|
process.addListener("exit", function () {
|
||
15 years ago
|
assert.equal(1, first);
|
||
|
assert.equal(1, second);
|
||
15 years ago
|
});
|