vuoi
o PayPal
tutte le volte che vuoi
msgrcv
If (msgflg & IPC_NOWAIT) is non-zero, the calling thread will return immediately with a return value of -1 and errno set to [ENOMSG].
If (msgflg & IPC_NOWAIT) is 0, the calling thread will suspend execution until one of the following occurs:
- A message of the desired type is placed on the queue.
- The message queue identifier msqid is removed from the system; when this occurs, errno is set equal to [EIDRM] and -1 is returned.
- The calling thread receives a signal that is to be caught; in this case a message is not received and the calling thread resumes execution in the manner prescribed in sigaction().
Upon successful completion, the following actions are taken with respect to the data structure associated with msqid:
- msg_qnum is decremented by 1.
- msg_lrpid is set equal to the process ID of the calling process.
- msg_rtime is set equal to the current time.
RETURN VALUE
Upon successful completion, msgrcv() returns a value equal to
The number of bytes actually placed into the buffer mtext. Otherwise, no message will be received, msgrcv() will return(ssize_t)-1 and errno will be set to indicate the error.
ERRORS
- [E2BIG] The value of is greater than msgsz and (msgflg & MSG_NOERROR) is 0.mtext
- [EACCES] Operation permission is denied to the calling process. See IPC.
- [EIDRM] The message queue identifier msqid is removed from the system.
- [EINTR] The msgrcv() function was interrupted by a signal.
- [EINVAL] msqid is not a valid message queue identifier.
- [ENOMSG] The queue does not contain a message of the desired type and (msgflg &IPC_NOWAIT) is non-zero.
EXAMPLES
None.
APPLICATION USAGE
The POSIX Realtime Extension defines alternative interfaces for interprocess