• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisionaf803a83cce33d840330b71f6e8edfac7ef62a30 (tree)
Time2013-01-22 06:11:01
AuthorKatsuhiko Nishimra <ktns.87@gmai...>
CommiterKatsuhiko Nishimra

Log Message

tmp Exit when caught signal

Change Summary

Incremental Difference

--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -18,6 +18,7 @@
1818 //************************************************************************//
1919 #include<stdio.h>
2020 #include<stdlib.h>
21+#include<signal.h>
2122 #include<iostream>
2223 #include<vector>
2324 #include<stdexcept>
@@ -30,7 +31,19 @@
3031 #include"base/Molecule.h"
3132 #include"base/MolDS.h"
3233 using namespace std;
34+
35+void my_signal_handler(int signal){
36+ cerr << "Caught signal " << signal << "!" << endl << flush;
37+ cout << flush;
38+ exit(1);
39+}
40+
3341 int main(int argc, char *argv[]){
42+ signal(SIGINT, my_signal_handler);
43+ signal(SIGTERM, my_signal_handler);
44+ signal(SIGHUP, my_signal_handler);
45+ signal(SIGILL, my_signal_handler);
46+ signal(SIGABRT, my_signal_handler);
3447 try{
3548 boost::shared_ptr<MolDS_base::MolDS> molds(new MolDS_base::MolDS());
3649 molds->Run(argc, argv);