Browse Source

Don't always enable debug on startup

Improves startup time. Problem introduced in
4ab5476e89
v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
bca6e35b2b
  1. 16
      src/node.cc

16
src/node.cc

@ -2343,13 +2343,6 @@ static void EnableDebug(bool wait_connect) {
static volatile bool hit_signal; static volatile bool hit_signal;
static void EnableDebugSignalHandler(int signal) {
// This is signal safe.
hit_signal = true;
v8::Debug::DebugBreak();
}
static void DebugSignalCB(const Debug::EventDetails& details) { static void DebugSignalCB(const Debug::EventDetails& details) {
if (hit_signal && details.GetEvent() == v8::Break) { if (hit_signal && details.GetEvent() == v8::Break) {
hit_signal = false; hit_signal = false;
@ -2359,6 +2352,14 @@ static void DebugSignalCB(const Debug::EventDetails& details) {
} }
static void EnableDebugSignalHandler(int signal) {
// This is signal safe.
hit_signal = true;
v8::Debug::SetDebugEventListener2(DebugSignalCB);
v8::Debug::DebugBreak();
}
#ifdef __POSIX__ #ifdef __POSIX__
static int RegisterSignalHandler(int signal, void (*handler)(int)) { static int RegisterSignalHandler(int signal, void (*handler)(int)) {
@ -2480,7 +2481,6 @@ char** Init(int argc, char *argv[]) {
} else { } else {
#ifdef __POSIX__ #ifdef __POSIX__
RegisterSignalHandler(SIGUSR1, EnableDebugSignalHandler); RegisterSignalHandler(SIGUSR1, EnableDebugSignalHandler);
Debug::SetDebugEventListener2(DebugSignalCB);
#endif // __POSIX__ #endif // __POSIX__
} }

Loading…
Cancel
Save