Thursday, April 26th 2018, 11:00pm UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

lawberman

Beginner

Date of registration: Jan 6th 2008

Posts: 15

1

Monday, February 4th 2008, 3:24pm

passing a pointer to a stack variable to a mailbox

Hi

Would there a be problem calling OS_PutMail for a multi byte message, passing it a pointer to a temporary stack variable, for example:

void aFunction(void)
{
short int aMsg = 12345678;

OS_PutMail(&aMB, &aMsg);
}

Thanks
Lawrence

Date of registration: Dec 20th 2007

Posts: 26

2

Wednesday, February 6th 2008, 2:34pm

Hi,

No problem, you may use local variables to pass data via mailbox.
The mailbox stores the data and not the pointer to the data.
When calling OS_PutMail(), the data which is pointed to by the data pointer is copied into the mailbox buffer, before the OS_PutMail() function is left.

Regards,
Armin

Similar threads