Pending signals and signal blocking

Source: Internet
Author: User
Article Title: Pending signals and blocked signals. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Signal status:

The "pending" Status of the signal refers to the period from the generation of the signal to the time before the signal is processed;

The "blocking" of a signal is a switch action that prevents the signal from being processed, but does not prevent the signal from being generated.

The example of APUE blocks the exit signal with sigprocmask before sleep, then sleep, and generates an exit signal during sleep, but the exit signal is blocked at this time, ("blocking" in Chinese is easy to be misunderstood as a State. It is actually a switch-like action, so "blocked" rather than "blocked ") so it is in the pending status. After sleep, use sigprocmask to turn off the blocking switch of the exit signal, because the exit signal generated previously remains in the pending status. When the blocking switch is closed, exit the "pending" status immediately and get processed. This happens before sigprocmask returns.

Conclusion: blocked signals are not discarded, but not processed. This status is called the pending status.

After blocking is removed, signals in the pending status will be processed.

Call sigprocmask to remove blocking, but the blocking action is completed before sigprocmask returns.

The pending signal processing is required before the function sigprocmask returns.

Int sigpend (sigset_t * set); --- obtain the pending signal.

Int sigprocmask (int how, const sigset_t * set, sigset_t * oset );

---- Depending on the value of how, it is the completed action, blocking, and blocking relief.

Note: The pending signals cannot be the same. If the signal is generated

Once and once again, it will be discarded.

Of course, if it is a real-time signal, it is another matter. Because real-time signals can have multiple identical pending signals.

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.