refactored handleSignal
[physics.git] / src / handleSignal.cpp
index 9068827..cd1fcec 100644 (file)
 
 #include <iostream>
 #include <signal.h>
+#include <stdlib.h>
 
 /// ***** Private Method Headers *****
 
-void sighandler( int sig );
+static void sighandler( int iSig );
 
 /// ***** Public Methods *****
 
 void installSignal()
 {
+#ifndef __WIN32__
     // register signal handler
     struct sigaction sa;
     sigemptyset( &sa.sa_mask );
@@ -38,14 +40,16 @@ void installSignal()
     {
         std::cerr << "could not install SIGINT handler" << std::endl;
     }
+#endif // __WIN32__
 }
 
 /// ***** Private Methods *****
 
 // signal handler function
-void sighandler( int sig )
+void sighandler( int iSig )
 {
-    switch(sig)
+#ifndef __WIN32__
+    switch(iSig)
     {
         case SIGINT:
             std::cerr << "SIGINT caught" << std::endl;
@@ -55,5 +59,6 @@ void sighandler( int sig )
     }
 
     // normally an abort is better ... but this is just SIGINT
-    exit(sig);
+    exit(iSig);
+#endif // __WIN32__
 }