28 static bool sigreceived;
30 void handle_signal(
int signum)
32 cout <<
"Signal " << signum <<
" received" << endl;
39 signal(SIGINT, handle_signal);
40 signal(SIGQUIT, handle_signal);
41 signal(SIGTERM, handle_signal);
42 signal(SIGPIPE, handle_signal);
48 signal(SIGINT, SIG_DFL);
49 signal(SIGQUIT, SIG_DFL);
50 signal(SIGTERM, SIG_DFL);
51 signal(SIGPIPE, SIG_DFL);
120 env =
new Env(appname);
122 env =
new Env(appname, inipath);
125 if (chdir(env->
path.c_str()) != 0)
138 env->server = (*cb_newServer)(env);
140 env->server =
new Server(env);
143 env->server->
start();
153 cerr << e.
msg() << endl;
156 if (env->server)
delete env->server;
void start()
Start a new thread in the joinable state.
void stop()
Stop thread execution.
Main server class for a MCS-based application.
Hold informations about an event.
string path
Main server path (APPD).
void sleep_ms(unsigned int millisec)
A millisecond resolution sleep function.
#define MCS_ERROR(A, rest...)
Facility to easily pass all necessary parameter to an Event constructor.
string msg()
Returns the message.
Main include file for all MCS based applications.
Env * mcsStart(string appname, string inipath="", Server *(*cb_newServer)(Env *)=NULL)
Start a MCS server.
bool cl_logstdout
Copy log on stdout.
#define MCS_STATE_RUNNING
Thread state: the separate thread is executing the run() method.
Hold all environment variables.
int state()
Return the state of the thread.
Namespace for MCS library.