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?

Tagged:

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @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.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.