Page 1 of 1

Watch Status of Messages and Queue

PostPosted: Fri Dec 29, 2000 8:57 am
by luben

As you menshened in the new Salvo 2.2 you intend to add some functions like OSStatTask() that will return the status of the tasks.

Will be very good if you could add OSStatMsg() and OSStatMsgQ().

Immagine that you use the queue and you fill it with bytes comming from serial. When you'll stop to fill it - when you receive error trying to OSSignalMsgQ(). But it's too late - you have one "hot" byte that you should keep somewhere, that you have to care specially and to add additional algorythm to manage it.

Would be good if you could before signaling the message to check is the queue empty or better - are there free positions and how much they are. And if there is no free positions you just disable the comming of the new bytes.

Having idea of how many free positions you have into message queue or is the message event empty you'll be able to simplify the algorythm of the managing events in the user program.

If you apply the idea of current version of Salvo to your car and tank for petrol it will looks like this - "If the car stops working - tank is empty - go to the petrol station. If when you go to the petrol station and petrol comes out from the tank when you try to fill it - tank is filled, smoke a cigarette to wait until tank free some space". I think that is better to have some petrol meter, right? At least you have to aggree that if your petrol meter in your car is broken you'll be in trouble.

I think that such commands like OSStatMsg() and OSStatMsgq() will complete the Salvo functions, they are in "style" of Salvo and will not consume big memory. Well, it needs some efforts from yor side.


Re: Watch Status of Messages and Queue

PostPosted: Tue Jan 09, 2001 7:25 am
by NoMore
Smoking on a petrol station can affect your health
And when you organize your Msg Queue, you have 2 pointers to the head and the tail of the queue. When you OSSignalMsgQ put your msg (char, int whatever) to *tail_pointer and increment tail_pointer. When you OS_WaitMsgQ you get your msg (char, int, whatever type) from the *head_pointer and increment head of the queue. And if (head_pointer == tail_pointer) TheQisEmpty ();
There should be example in the manual how to implement this.
And give up smoking... especially on petrol stations : ))))))))

Re: Watch Status of Messages and Queue

PostPosted: Tue Jan 09, 2001 9:21 am
by aek
OSMsgQFull() (returns TRUE if full, FALSE if space available) is part of the v2.2 release.