Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-12-2009, 11:15 AM   #1
LQ Newbie
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
Question Posix Message queue, mq_receive process conflict

Hello all,

I have a problem with my message queue system...

I used to use system V type mq system but then I figured out that posix mq system was existed and was indeed much more efficient..

So my question is this, while I was using System V type message queue I was receiving messages like that;

MessageBuffer* m_message = malloc(sizeof(MessageBuffer));
int RECEIVER = 2;

(...) unrelevant preperations
msgrcv(mq_id, m_message, sizeof(MessageBuffer) - sizeof(long), RECEIVER, 0);
in here RECEIVER is my process's mq code, no other processes but RECEIVER receives messages from queue which tagged with type = RECEIVER..

but at posix message queues no such message flags exists, for example at mq_receive:

mq_receive(mq_id, (char*)m_message, sizeof(MessageBuffer),0);
Sometimes even sender process receives messages more quickly than target process so messaging fails.

How can I distinguish those different processes from each other on a linux system? Any idea?



message, queue

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible for me to write in front of queue in case of message queue? hemanthv414 Linux - Newbie 1 11-17-2008 04:40 PM
how to clear a posix message queue navalbabu Programming 5 01-11-2008 01:37 PM
POSIX message queues(Solaris) to SYS V message queues(Linux) devershetty Programming 1 01-22-2007 10:15 AM
does rh9.0 support POSIX message queue? simon_qwl Programming 1 07-22-2005 05:25 PM

All times are GMT -5. The time now is 08:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration