Management signals of C ++ in LINUX

Source: Internet
Author: User
The management signal of C ++ in LINUX-general Linux technology-Linux programming and kernel information. The following is a detailed description. Every time a process executes an annoying action, so that Linux? When the kernel sends a signal, the signal must be processed. Signal processing programs usually release some important resources and terminate applications. In this case, all the object instances on the stack are in the undamaged state. On the other hand, if these signals are converted to C ++ exceptions, You can elegantly call their constructor and arrange multi-layer catch blocks to better process these signals.

The SignalExceptionClass defined in Listing 2 provides an abstraction of the C ++ exception that represents a possible signal from the kernel. SignalTranslator is a template class based on SignalExceptionClass, which is usually used to implement conversion to C ++ exceptions. At any moment, only one signal processing program can process one signal of an active process. Therefore, SignalTranslator adopts the singleton design mode. The overall concept is presented through the SegmentationFault class for sigsegv and the FloatingPointException class for SIGFPE.

Listing 2. Converting signals to exceptions
QUOTE:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.