Fix for AVATAR_JS-156, allow for concurrent signal handlers, patched test
This commit is contained in:
parent
31d6bb37f7
commit
16bfaa6fba
|
@ -325,6 +325,7 @@
|
|||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-repl.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-script-context.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-setproctitle.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-signal-handler.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-stdin-from-file.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-stdout-close-catch.js"/>
|
||||
<apply-diff src="test/simple" mod="${test.dir}/simple" name="test-stdout-to-file.js"/>
|
||||
|
@ -426,6 +427,7 @@
|
|||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-repl.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-script-context.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-setproctitle.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-signal-handler.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-stdin-from-file.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-stdout-close-catch.js"/>
|
||||
<apply-patch-file target="${test.dir}/simple" dir="test/simple" name="test-stdout-to-file.js"/>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
--- ../node/test/simple/test-signal-handler.js 2013-12-09 10:27:27.000000000 +0100
|
||||
+++ ./test/simple/test-signal-handler.js 2014-01-13 18:13:37.000000000 +0100
|
||||
@@ -27,6 +27,9 @@
|
||||
|
||||
var common = require('../common');
|
||||
var assert = require('assert');
|
||||
+// Avatar.js specific
|
||||
+process.signals.start('SIGHUP');
|
||||
+process.signals.start('SIGUSR1');
|
||||
|
||||
console.log('process.pid: ' + process.pid);
|
||||
|
|
@ -519,6 +519,7 @@ source.test.simple.list = \
|
|||
test-script-this.js \
|
||||
test-setproctitle.js \
|
||||
test-sigint-infinite-loop.js \
|
||||
test-signal-handler.js \
|
||||
test-signal-unregister.js \
|
||||
test-socket-write-after-fin-error.js \
|
||||
test-socket-write-after-fin.js \
|
||||
|
|
|
@ -65,7 +65,7 @@ var LibUV = Packages.com.oracle.libuv.LibUV;
|
|||
var CheckHandle = Packages.com.oracle.libuv.handles.CheckHandle;
|
||||
var IdleHandle = Packages.com.oracle.libuv.handles.IdleHandle;
|
||||
var SignalHandle = Packages.com.oracle.libuv.handles.SignalHandle;
|
||||
|
||||
var Map = java.util.HashMap;
|
||||
var Process = Packages.com.oracle.avatar.js.os.Process;
|
||||
var Server = Packages.com.oracle.avatar.js.Server;
|
||||
var Constants = Packages.com.oracle.libuv.Constants;
|
||||
|
@ -703,13 +703,6 @@ Object.defineProperty(exports, '_needImmediateCallback', {
|
|||
}
|
||||
});
|
||||
|
||||
var signalHandle = new SignalHandle(eventloop.loop());
|
||||
// this handle should not keep the event loop from terminating
|
||||
signalHandle.unref();
|
||||
signalHandle.signalCallback = function(signum) {
|
||||
exports.emit(Constants.getConstantsString().get(signum));
|
||||
}
|
||||
|
||||
// do not install any signal handlers by default
|
||||
// some generate EINVAL (invalid argument)
|
||||
// and the JVM installs some of its own and we do not want to cause conflicts
|
||||
|
@ -717,9 +710,23 @@ signalHandle.signalCallback = function(signum) {
|
|||
// process.signals.start('SIGUSR1');
|
||||
// or
|
||||
// process.signals.start(43);
|
||||
Object.defineProperty(exports, 'signals', {
|
||||
exports.signals = { cache: new Map() };
|
||||
Object.defineProperty(exports.signals, 'start', {
|
||||
enumerable: true,
|
||||
value: signalHandle
|
||||
value: function(signal) {
|
||||
var signalHandle = exports.signals.cache.get(signal);
|
||||
if (!signalHandle) {
|
||||
|
||||
signalHandle = new SignalHandle(eventloop.loop());
|
||||
// this handle should not keep the event loop from terminating
|
||||
signalHandle.unref();
|
||||
signalHandle.signalCallback = function(signum) {
|
||||
exports.emit(Constants.getConstantsString().get(signum));
|
||||
}
|
||||
signalHandle.start(signal);
|
||||
exports.signals.cache.put(signal, signalHandle);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (exports.platform !== 'win32') {
|
||||
|
|
Loading…
Reference in New Issue