Groovy hepcat Gvs was jivin' on Thu, 19 May 2005 13:13:48 +0800 in
comp.lang.c.
message passing question's a cool scene! Dig it!
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 messages in my queue. I'm using
the following lines of code to do this, however the queue is always saying
it has 0 messages, i check with ipcs and it has multiple (+30) some times.
What am i doing wrong ?
---------------------
while (ds.msg_qnum < nChairs)
{
printf("number of chairs : %d\n", nChairs);
printf("number of messages : %d\n", ds.msg_qnum);
}
----------------------
I have more code that adds the messages inside this while loop .. but i
ommitted it for simplicity.
Umph! A guy goes to his local mechanic and says, "My car has
something wrong with its gearbox. I can't change gear. I've brought
along the locking bolts from a couple of the cogs inside the gearbox
to show you. What could be the trouble?"
What do you think the mechanic said to the guy? Now you know what we
want to say to you.
Please post the smallest *complete* program that demonstrates the
problem. By "complete" I mean something you expect to compile and run.
If your program is long, cut out everything extraneous, leaving just
enough to show the problem - but *complete*. And make sure what you
post actually does show the problem. You'll also need to tell us
exactly how the code is supposed to work, as well as a concise but
reasonably detailed description of the behaviour you observe and how
this differs from the behaviour you expect.
We can't tell anything from what you have posted. We're not mind
readers. You have to give us something to go on.
--
Dig the even newer still, yet more improved, sig!
http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?