question

Upvotes
Accepted
5 0 1 4

Signal processing in RFA application

I use RFA based library that can be used from C++ and python (using SWIG) on Linux. My goal is to process SIGINT and SIGTERM in main application thread. Could you clarify, how can I clean signal mask in RFA threads to get signals in main application thread?

rfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
47.5k 113 44 60

@dmitry.rusakov

The StarterConsumer example in the RFA package shows the example of how to call the sigaction method to change the action taken by a process on receipt of a specific signal.

The code is in the StarterCommon/CtrlBreakHandler.cpp file.

        bzero(&_sigAction, sizeof(_sigAction));
        bzero(&_oldSigAction, sizeof(_oldSigAction));
        _sigAction.sa_sigaction = &sigActionExternC;
        _sigAction.sa_flags     = SA_SIGINFO;
        if(-1 == sigaction(SIGINT, &_sigAction, &_oldSigAction))
        {
            AppUtil::log(__LINE__, AppUtil::ERR, "CtrlBreakHandler::init() sigaction() FAILED);//, errno: %d", errno);
        }

I think that you can do the same with SIGTERM.

For more information, please refer to the sigaction Linux manual page.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.