473,545 Members | 2,291 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a message queue with a specific ID

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
4 2755
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.progr ammer, comp.os.ms-windows.program mer.win32 is good for
Windows, and there are many others for other OSs.

Lawrence

Nov 14 '05 #2
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.c om, 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
On Thu, 03 Feb 2005 14:41:56 +0000, Lawrence Kirby
<lk****@netacti ve.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.progr ammer, comp.os.ms-windows.program mer.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.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #4
Thanks for the help. Sorry for not being more specific. I have raised
my queries in comp.unix.progr ammer.

Thanks again.

Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2761
by: phil | last post by:
And sorry I got ticked, frustrating week >And I could help more, being fairly experienced with >threading issues and race conditions and such, but >as I tried to indicate in the first place, you've >provided next to no useful (IMHO) information to >let anyone help you more than this This is about 5% of the code. Uses no locks.
29
4193
by: Paul L. Du Bois | last post by:
Has anyone written a Queue.Queue replacement that avoids busy-waiting? It doesn't matter if it uses os-specific APIs (eg WaitForMultipleObjects). I did some googling around and haven't found anything so far. Because I know someone will ask: no, the busy-waiting hasn't been a problem in my app. I'm just interested in reading the code. p
7
7842
by: mike | last post by:
Hi, I am having difficulty in creating a thread using pthread_create. It seems that pthread_create does not execute 'program', and returns -1; I have checked the API but I am not sure why this isn't working. #include <stdio.h> #include <pthread.h>
2
1864
by: Gvs | last post by:
Hi, I'm currently trying to pass messages into a queue. This all works fine, however, i'm trying to my program to stop sending messages to the queue when it reaches an upper threshold. At present this threshold is the number of chairs in a waiting room. This is an int represented by nChairs. So i want to compare this to the number of...
2
18779
by: Tony Hamill | last post by:
Hi, can somebody provide me with the correct syntax for creating a message queue in C#. I have private void button1_Click(object sender, System.EventArgs e) { // C# try{
2
2750
by: Steve Lutz | last post by:
Hi All, I am trying to read and write to a message queue. (System.Messaging) I can read and write to a queue. However, the consummers of the queue messages are going to be a mixed bag of application, some of which I do not have control over. When I send a message to the queue, the body of the message is formatted into XML. I do not want...
13
11256
by: LordHog | last post by:
Hello all, I have a little application that needs to poll a device (CAN communications) every 10 to 15 ms otherwise the hardware buffer might overflow when there are message burst on the bus. I would implement an interrupt driven model, but the external device (which is connected via USB) does not support interrupts therefore the device...
3
4997
by: Ahmad Jalil Qarshi | last post by:
Hi, I have developed an application in C on IBM AIX 5.2. Its using multiple Message Queues to share data between different processes. I am using following functions to send/receive messages into/from message queues: int msgget(key_t, int); ssize_t msgrcv(int, void *, size_t, long int, int); int msgsnd(int, const void *,...
2
2651
by: slizorn | last post by:
hi guys, i need to make a tree traversal algorithm that would help me search the tree.. creating a method to search a tree to find the position of node and to return its pointer value basically i need to read in a text file... shown below H H,E,L E,B,F B,A,C A,null,null
0
7398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7416
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7752
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5969
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
701
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.