I have a c++ application linked against some c libraries.
Are there possible approaches to encapsulate the signal handling in a C++ class, so it could be handled as a c++ exception?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t and if you could a lot of things would break.
What you should do is set a flag in the signal handler, periodically check in your code and throw an exception when you detect the flag is set.
Such an approach is similar to how threads get interrupted in Boost.Threads, which I strongly suggest you study.