| Previous | Next |
| MACH_RCV_TOO_LARGE | MACH_RCV_PORT_CHANGED |
MACH_RCV_INTERRUPTED
Receive cancellation, not message failure
MACH_RCV_INTERRUPTED reports that a software interrupt stopped a waiting receive. It is normally exposed only when MACH_RCV_INTERRUPT is selected; otherwise the mach_msg wrapper may retry the interrupted system call. The code says nothing about the sender or the validity of the receive port. No message was dequeued for this result.
Applications should treat this as a controlled cancellation point. A loop that immediately retries forever defeats the reason for requesting interruptible behavior, while a loop that exits unconditionally can leak server state. Decide whether interruption means shutdown, a deadline check, a state transition, or merely a prompt to recompute the remaining timeout.
Handling guidance
- Record why the thread was interrupted and which receive options were active.
- Use an application cancellation token or shutdown state to decide whether to resume receiving.
- When enforcing a deadline, recompute remaining time rather than restarting the full interval.
- Keep cleanup of receive rights separate from interruption handling so a subsequent receive does not use a deallocated name.
References
- Mach Kernel Interface Reference: mach_msg
- Apple XNU source: mach_msg implementation
- Apple Kernel Programming Guide: Mach overview
Looking for a different code? Search another status or error code.