Index: runtime/bin/process.h |
diff --git a/runtime/bin/process.h b/runtime/bin/process.h |
index 2886e71d7c84f5308b4742de80037eacf04c2eee..4ef892908d802492ec0393f22b2fcabda1286b83 100644 |
--- a/runtime/bin/process.h |
+++ b/runtime/bin/process.h |
@@ -126,6 +126,16 @@ class Process { |
global_exit_code_ = exit_code; |
} |
+ typedef void (*ExitHook)(int64_t exit_code); |
+ static void SetExitHook(ExitHook hook) { |
+ exit_hook_ = hook; |
+ } |
+ static void RunExitHook(int64_t exit_code) { |
+ if (exit_hook_ != NULL) { |
+ exit_hook_(exit_code); |
+ } |
+ } |
+ |
static intptr_t CurrentProcessId(); |
static intptr_t SetSignalHandler(intptr_t signal); |
@@ -139,6 +149,7 @@ class Process { |
private: |
static int global_exit_code_; |
static Mutex* global_exit_code_mutex_; |
+ static ExitHook exit_hook_; |
DISALLOW_ALLOCATION(); |
DISALLOW_IMPLICIT_CONSTRUCTORS(Process); |