[ECOS] ecos state machine

Andrew Lunn andrew.lunn@ascom.ch
Wed Aug 14 01:10:00 GMT 2002


Is this a troll?

O well:

On Wed, Aug 14, 2002 at 01:19:29PM +0800, ?? ?? wrote:
> 
> hi,nickg!

>   mail box in ecos maybe unsafe :
>            char *msg="hello!nickg";
>          cyg_mbox_put(mbox,(void*)msg);
>           ...
>          free(msg);
>          return //danger:if now msg has not  yet received.


Mail boxes are used to just pass a void * between threads. What that
void * represents is of no concern to the mbox. It could be a pointer
to a string as in your example. It could be a pointer to the hardware
address of a serial port. It could be the just an integer used in
implementing a Phyllotaxis Prime number sieve.

The mbox is not dangerous. Your code around the mbox is dangerous.

    Andrew

P.S.

You should not call free on static memory!

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list