谁能告诉我,如果在mq_send执行期间多线程程序收到SIGSTOP信号,会发生什么情况?
The man page for mq_send
indicates it is implemented on top of mq_timedsend
, which is a system call in Linux. System calls are generally atomic in that they either succeed or they don't. If a system call is interrupted by a signal, the usual behavior is to return -1 and set errno
to EINTR
. It looks like mq_send
has this behavior.
Basically, you should check for EINTR
, and retry the call if it fails in this way. This is particularly important for system calls that may block like recv
or select
, since they have a higher chance of being interrupted.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.