By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,874 Members | 1,058 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,874 IT Pros & Developers. It's quick & easy.

Creating a message queue with a specific ID

P: n/a
Hi all,

Is it possible to create a message queue with a specific ID? I want to
do this because I'm trying to write a piece of software which restores
communicating processes (which communicate through message queues) when
there is a machine failure. When restarting the machine I need to setup
the message queues as they were originally.

I find that given the same key, when creating a queue, the queue ID is
not always the same value. Is there any way to specify this value? The
only solution I can think of at the moment is to store the original
queue ID as a variable and repeatedly create queues until the original
message queue ID is used.

Thanks in advance.

Nov 14 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Thu, 03 Feb 2005 02:58:19 -0800, Tingo wrote:
Hi all,

Is it possible to create a message queue with a specific ID?
It is not possible to create a message queue in standard C.
I want to
do this because I'm trying to write a piece of software which restores
communicating processes (which communicate through message queues) when
there is a machine failure. When restarting the machine I need to setup
the message queues as they were originally.


Presumably you are referring to some sort of platform-specific extension.
It is difficult to say which extension or indeed platform you are talking
about. If you are programming on a Unix related platform try asking in
comp.unix.programmer, comp.os.ms-windows.programmer.win32 is good for
Windows, and there are many others for other OSs.

Lawrence

Nov 14 '05 #2

P: n/a
Lawrence Kirby wrote:
On Thu, 03 Feb 2005 02:58:19 -0800, Tingo wrote:

Is it possible to create a message queue with a specific ID?


It is not possible to create a message queue in standard C.


While I greatly doubt this is what the OP wants (he should probably
go to a newsgroup that deals with his system), he can certainly
create and post the code involved, and then ask questions about it
here. Something like:

typedef struct msgitem {
struct msgitem *next;
char *datum; /* diddle this field to taste */
int id;
} msgitem;

typedef struct msgqueue {
first *msgitem;
last *msgitem;
} msgqueue;

together with routines to add, extract, checkemptyness would do.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson

Nov 14 '05 #3

P: n/a
On Thu, 03 Feb 2005 14:41:56 +0000, Lawrence Kirby
<lk****@netactive.co.uk> wrote in comp.lang.c:
On Thu, 03 Feb 2005 02:58:19 -0800, Tingo wrote:
Hi all,

Is it possible to create a message queue with a specific ID?


It is not possible to create a message queue in standard C.
I want to
do this because I'm trying to write a piece of software which restores
communicating processes (which communicate through message queues) when
there is a machine failure. When restarting the machine I need to setup
the message queues as they were originally.


Presumably you are referring to some sort of platform-specific extension.
It is difficult to say which extension or indeed platform you are talking
about. If you are programming on a Unix related platform try asking in
comp.unix.programmer, comp.os.ms-windows.programmer.win32 is good for
Windows, and there are many others for other OSs.

Lawrence


It is perfectly possible to create message queues in standard C. I've
done it quite frequently, in strictly conforming code that will
compile with any conforming compiler. They are quite useful in "super
loop" type programs in systems too small to need an operating system.

But I do agree that it is impossible to create the sort of message
queue that the OP is talking about, some sort of platform specific
structure for communicating between different computers, without
resorting to some platform specific API.

I'll be happy to post a really nice implementation of message queue
creation and management in strictly conforming C90 if you really don't
think it can be done.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #4

P: n/a
Thanks for the help. Sorry for not being more specific. I have raised
my queries in comp.unix.programmer.

Thanks again.

Nov 14 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.