This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: ecos state machine
- From: Andrew Lunn <andrew dot lunn at ascom dot ch>
- To: ÕÅ ÁÁ <johnsonest at hotmail dot com>
- Cc: nickg at calivar dot demon dot co dot uk, ecos-discuss at sources dot redhat dot com
- Date: Wed, 14 Aug 2002 09:58:23 +0200
- Subject: Re: [ECOS] ecos state machine
- References: <F114YZgy86aezUF0d0H00005221@hotmail.com>
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