Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GT.M Call-Ins and Signals

98 views
Skip to first unread message

Sergey Povarnin-Lelikov

unread,
Mar 19, 2013, 10:58:49 AM3/19/13
to
Hello all!
I have developed server application on C++ and start it as daemon. Application use GT.M Call-Ins wrapper (which used gtm_init(),...,gtm_exit()). Application starts Server (TCP) logic and Processor logic. Processor create Task (separate thread) which work with my GT.M Call-Ins wrapper, on start - gtm_init(), on stop - gtm_exit().

Start daemon: (application) --daemon

But I have stoped Application's Server and Processor only after SIGTERM or SIGQUIT signals, because Application wait for termination

I use C++ library POCO:

void Poco::ServerApplication::waitForTerminationRequest()
{
sigset_t sset;
sigemptyset(&sset);
if (!std::getenv("POCO_ENABLE_DEBUGGER"))
{
sigaddset(&sset, SIGINT);
}
sigaddset(&sset, SIGQUIT);
sigaddset(&sset, SIGTERM);
sigprocmask(SIG_BLOCK, &sset, NULL);
int sig;
sigwait(&sset, &sig);
}

Stop daemon: killall (application)

And from GT.M Programmer's Guide I have read:
"The external application should never use any signals when GT.M is active since GT.M reserves them for its internal use."

Question 1: How stop Processor (execute GT.M Call-Ins wrapper gtm_exit()) before daemon receive signal KILL? :(
Question 2: When daemon receive signal, it stop Server normally but when stopping Processor it failed with
"%GTM-F-KILLBYSIGSINFO1, GT.M process 22408 has been killed by a signal 11 at address 0x00007FE0E8085690 (vaddr 0x00007FE0E8085690)
%GTM-F-SIGACCERR, Signal was caused by invalid permissions for mapped object
Quit (core dumped)"
Is this paintfully for GT.M? :(

Very thanks for answers!
PS: Maybe you prompt me how send command to daemon and I can send stop before killall (application)?

Sergey Povarnin-Lelikov

unread,
Mar 20, 2013, 9:28:22 AM3/20/13
to
I find some solution in NodeM project:

mumps.cc:
Handle<Value> Gtm::open(const Arguments &args)
- execute gtm_init()
- register signal handler catch_intr(int signum)

static void catch_intr(int signum)
- execute gtm_exit()
- exit()

And I try this solution in my project. :)
0 new messages