This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ecos state machine


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]