void ESRModule::signal_handler(int signal)
{
// do_exit(int) is also a non-static member function of the class ESRModule
do_exit(0);
}
void ESRModule::init()
{
signal(SIGTERM, [this](int signal){return this->signal_handler(signal);});
}
As you can see, the above code has build errors. If there is no class encapsulation, then no error. And I do not wanna declare signal_handler(int)
as static. If so, I have to declare do_exit(int)
as static too. Is there anyone who can help me about how to write function init()
? Thank you so much!
Aucun commentaire:
Enregistrer un commentaire