This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
FW: ecos state machine
- From: "Geoff Patch" <grp at cea dot com dot au>
- To: <ecos-discuss at sources dot redhat dot com>
- Date: Wed, 14 Aug 2002 15:53:38 +1000
- Subject: [ECOS] FW: [ECOS] ecos state machine
> 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.
>
No. The mailbox mechanism is not unsafe. That particular usage is unsafe.
The mailbox mechanism allows the application programmer to transmit data
from one thread to another. If the programmer does something dangerous, the
problem lies with the programmer, not the mailbox mechanism.
In other words, it's up to you to ensure that the contents of the mailbox
points to something sensible when the receiving thread accesses it.
Cheers
Geoff
-----------------------------
Geoff Patch
Senior Software Engineer
CEA Technologies
Canberra Australia
02-6213-0
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss