实时信号的意义?

发布于 2024-12-03 12:38:14 字数 75 浏览 1 评论 0原文

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

谢谢。

Standard signal, allows only one signal can be queued. Real Time signal allows more than one signal can be queued. Is it the only difference ?. Or, do we have some other advantage ?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮凉 2024-12-10 12:38:14

根据 signal(7) 手册页,有几个区别:

   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.

According to the signal(7) manpage, there are several differences:

   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.
扬花落满肩 2024-12-10 12:38:14

例如,此处总结了这些差异。

The differences are summarized, for example, here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文