]> khamidou — GitHub mirrors - electron.git/commitdiff
process: add hang method
authordeepak1556 <hop2deep@gmail.com>
Wed, 17 Jun 2015 14:43:43 +0000 (20:13 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Thu, 18 Jun 2015 08:44:29 +0000 (14:14 +0530)
atom/common/api/atom_bindings.cc
docs/api/process.md

index a210cc6931d25f4a9d5cd07a1dff9bbfc67a12b2..fa4a88d58437d561106858cffc71cb3cff539502 100644 (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)));
index 4afa6677b8aac7def6019963b5940680acfe40cf..c9efa22fe0f9634ead43b485f167cf148fbe6633 100644 (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.