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]

FW: 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


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