Sample Header Ad - 728x90

Handling multiple messages in message queue

0 votes
1 answer
2162 views
I've done some research about this topic but I didn't understand it quite well. From msgsnd man page : > The msgsnd() system call appends a copy of the message pointed to by > msgp to the message queue whose identifier is specified by msqid. Does this mean that when i use a msgget to create a message queue the Enqueue and Dequeue happens automatically with msgsnd and msgrcv? For example, if I want to use a message queue that can simultaneously hold N messages, when i use msgsnd i put a message to the queue and when i use msg rcv i get it from here and delete that message? If that's the case i shouldn't implement manually enqueue and dequeue to create a list of N messages because it's enough to set a value to const void *msgp from int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg); to add one more message in the queue and it is enough that this is received by msgrcv to be deleted from the queue otherwise it remains in the queue until it is received by some process, am i correct? But then how much messages this queue can contain if i'm not the one setting how many can be contained?
Asked by Zeno Raiser (227 rep)
Jan 4, 2018, 02:55 PM
Last activity: Feb 22, 2018, 11:02 AM