aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Kalowsky <daniel.kalowsky@intel.com>2014-04-29 15:55:31 -0700
committerAlexandra Yates <alexandra.yates@linux.intel.com>2014-05-01 10:02:14 -0700
commit5f5976f8b42e4e4717f2d573cf43cb87ccd88fa2 (patch)
tree78d4d5b92c527d8a1f9e8d7e497f977283530ab7
parented7fed7bf20436617e232f3b33a1b611567d1fb8 (diff)
downloadpowertop-2.0-5f5976f8b42e4e4717f2d573cf43cb87ccd88fa2.tar.gz
Adding a clean_shutdown function
Function is designed to be a on stop place to clean up the entire application at shutdown time.
-rw-r--r--src/main.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 72fd81b..c076a71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -359,6 +359,17 @@ static void powertop_init(void)
initialized = 1;
}
+void clean_shutdown()
+{
+ close_results();
+ close_display();
+ clean_open_devices();
+ clear_all_devices();
+ clear_all_cpus();
+
+ return;
+}
+
int main(int argc, char **argv)
{
@@ -486,9 +497,7 @@ int main(int argc, char **argv)
clear_tuning();
reset_display();
- clean_open_devices();
- clear_all_devices();
- clear_all_cpus();
+ clean_shutdown();
return 0;
}