gpt4 book ai didi

c - 实时信号的意义?

转载 作者:太空狗 更新时间:2023-10-29 12:21:15 25 4
gpt4 key购买 nike

标准信号,只允许一个信号可以排队。实时信号允许多个信号可以排队。这是唯一的区别吗?或者,我们还有其他优势吗?

谢谢。

最佳答案

根据signal(7) manpage ,有几点不同:

   Real-time signals are distinguished by the following:

1. Multiple instances of real-time signals can be queued. By con-
trast, if multiple instances of a standard signal are delivered
while that signal is currently blocked, then only one instance is
queued.

2. If the signal is sent using sigqueue(2), an accompanying value
(either an integer or a pointer) can be sent with the signal. If
the receiving process establishes a handler for this signal using
the SA_SIGINFO flag to sigaction(2) then it can obtain this data
via the si_value field of the siginfo_t structure passed as the
second argument to the handler. Furthermore, the si_pid and si_uid
fields of this structure can be used to obtain the PID and real
user ID of the process sending the signal.

3. Real-time signals are delivered in a guaranteed order. Multiple
real-time signals of the same type are delivered in the order they
were sent. If different real-time signals are sent to a process,
they are delivered starting with the lowest-numbered signal.
(I.e., low-numbered signals have highest priority.)

If both standard and real-time signals are pending for a process, POSIX
leaves it unspecified which is delivered first. Linux, like many other
implementations, gives priority to standard signals in this case.

关于c - 实时信号的意义?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7309119/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com