Modified the eoCtrlCContinue - had to create the eoCtrlCContinue.cpp

to make t-eoGA work (you should NOT have separate functions in .h files!)
I also included everything related to Ctrl C handling in #ifndef _MSC_VER
until someone tells me how to do it in MSVC
This commit is contained in:
evomarc 2001-04-09 15:28:24 +00:00
commit 3d757e3243
4 changed files with 72 additions and 31 deletions

View file

@ -23,39 +23,18 @@
mak@dhi.dk
*/
//-----------------------------------------------------------------------------
// the same thing can probably be done in MS environement, but I hoave no way
// to test it so at the moment it is commented out when in MSVC
#ifndef _MSC_VER
#ifndef eoCtrlCContinue_h
#define eoCtrlCContinue_h
#include <signal.h>
#include <eoContinue.h>
// --- Global variables - but don't know what else to do - MS ---
static bool arret_demande = false;
static bool existCtrlCContinue = false;
//
// The signal handler - installed in the eoCtrlCContinue Ctor
//
void signal_handler( int sig )
// ---------------------------
{
// --- On veut la paix, jusqu'a la fin ---
signal( SIGINT, SIG_IGN );
signal( SIGQUIT, SIG_IGN );
cerr << "Ctrl C entered ... closing down" << endl ;
arret_demande = true;
}
//
// Permet de savoir si on a appuye sur Control-C
// (renvoie alors 1)
//
int AppliArretDemande()
// --------------------
{
return arret_demande;
}
extern bool arret_demande, existCtrlCContinue;
extern void signal_handler( int sig );
/**
@ -67,7 +46,7 @@ class eoCtrlCContinue: public eoContinue<EOT>
public:
/// Ctor : installs the signal handler
eoCtrlCContinue()
eoCtrlCContinue()
{
// First checks that no other eoCtrlCContinue does exist
if (existCtrlCContinue)
@ -85,8 +64,9 @@ public:
return false;
return true;
}
};
#endif
#endif // of MSVC comment-out