debugger: make busy loops SIGUSR1-interruptible
authorBen Noordhuis <info@bnoordhuis.nl>
Tue, 15 Oct 2013 21:32:18 +0000 (23:32 +0200)
committerBen Noordhuis <info@bnoordhuis.nl>
Wed, 16 Oct 2013 18:24:13 +0000 (20:24 +0200)
commitca363cf1ae9631cd6465c3a0028ca0af823a68fb
tree58cd302b4d0d2f4973fda208ba859d4e9a050bc8
parent085dd30e93da67362f044ad1b3b6b2d997064692
debugger: make busy loops SIGUSR1-interruptible

Commit 30e5366b ("core: Use a uv_signal for debug listener") changed
SIGUSR1 handling from a signal handler to libuv's uv_signal_*()
functionality to fix a race condition (and possible hang) in the
signal handler.

While a good change in itself, it made it impossible to interrupt
long running scripts.  When a script is stuck in a busy loop, control
never returns to the event loop, which in turn means the signal
callback - and therefore the debugger - is never invoked.

This commit changes SIGUSR1 handling back to a normal signal handler
but one that treads _very_ carefully.
src/node.cc
test/simple/test-debug-cluster.js
test/simple/test-debug-port-cluster.js
test/simple/test-debug-port-from-cmdline.js
test/simple/test-debug-signal-cluster.js
test/simple/test-debugger-client.js