views:

82

answers:

1

Hi,

can anybody tell me what happens if multithread program receives SIGSTOP signal during execution of mq_send?

A: 

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.

Jay Conrod