New posts are disabled while we improve the user experience.

You can browse the site, or for urgent issues, raise a query at MyAccount.

question

Upvotes
Accepted
5 1 2 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

· Write an Answer
Upvotes
Accepted
87.8k 294 53 79

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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