G
Gvs
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 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.
Matt
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.
Matt