Merge pull request #1998 from deepak1556/process_patch

process: add hang method
This commit is contained in:
Cheng Zhao 2015-06-19 16:21:29 +08:00
commit befdfceada
2 changed files with 10 additions and 0 deletions

View file

@ -26,6 +26,11 @@ void Crash() {
static_cast<DummyClass*>(NULL)->crash = true;
}
void Hang() {
for (;;)
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
}
// Called when there is a fatal error in V8, we just crash the process here so
// we can get the stack trace.
void FatalErrorCallback(const char* location, const char* message) {
@ -54,6 +59,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate,
mate::Dictionary dict(isolate, process);
dict.SetMethod("crash", &Crash);
dict.SetMethod("hang", &Hang);
dict.SetMethod("log", &Log);
dict.SetMethod("activateUvLoop",
base::Bind(&AtomBindings::ActivateUVLoop, base::Unretained(this)));

View file

@ -7,3 +7,7 @@ upstream node:
* `process.versions['electron']` String - Version of Electron.
* `process.versions['chrome']` String - Version of Chromium.
* `process.resourcesPath` String - Path to JavaScript source code.
## process.hang
Causes the main thread of the current process hang.