Pumpkin, Inc.

Pumpkin User Forums

Problem with message queues

If you can't make Salvo do what you want it to do, post it here.

Problem with message queues

Postby helge » Thu Jan 15, 2004 6:11 am

Hi!

For some reason when I make calls that are specific to the MsgQs it affects a pointers that should have nothing to do with that call...

the code below returns a zero and sets messCounter to that if the Q is empty. However it also affects the char pointer mp's value? If I don't use the OSMsgQEmpty() call my program works fine. Why does the call OSMsgQEmpty() mess up the pointer value?

messCounter=(SIZEOF_MSGQSPI-OSMsgQEmpty(MSG_SPI_P));

tempbuffer[messCounter]=*mp;

helge
 
Posts: 3
Joined: Mon Nov 10, 2003 12:00 am

Re: Problem with message queues

Postby aek » Thu Jan 15, 2004 10:37 am

Hello.

OSMsgQEmpty() only creates a local (auto) pointer and returns a computed value of type OSMsgQSize() ... so it's not writing to anything.

Are you seeing / saying that messCounter is out-of-bounds?

In general, problems like these are due to mistakes when allocating memory for the message queue, e.g. one's application has two message queues but OSMESSAGE_QUEUES is only set to 1 in salvocfg.h.

Note that the libraries only support one message queue ... for more, you need to do a Pro source-code build, or build a custom library.

Let me know if this helped ...

------------------

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to Coding

Who is online

Users browsing this forum: No registered users and 2 guests

cron