Creating a message queue with a specific ID

T

Tingo

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.
 
L

Lawrence Kirby

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
 
C

CBFalconer

Lawrence said:
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.
 
J

Jack Klein

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


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.
 
T

Tingo

Thanks for the help. Sorry for not being more specific. I have raised
my queries in comp.unix.programmer.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top