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: question about the posix package


On Mon, Dec 29, 2003 at 11:29:02AM +0100, Stefano Martini wrote:
> Hi. I am in the process of porting to ecos a library using the pthread
> paradigm to support multithreaded safeness.
> At the end, this lib will be used by an existing ecos application (not
> using the posix package).
> Assumig to enable the posix package in my ecos build, can an ecos
> application (written not for posix) and a lib
> on top of posix work toghether?
> In other words, should I rewrite the ecos application to also use pthread?

Im not clear what you mean exactly. So i will answer in a more general
way.

Thread safeness is to do with the sharing of resources. If threads
don't share the same resources, you don't have anything to worry
about. 

If threads do share resources then you need to be thread safe. So you
need to use mutex, semaphores etc. There are two sets of API which
provide the needed primitives. There are the native eCos primitive
cyg_mutex_*, cyg_sem_* etc. And there are the POSIX equivalent. 

To be safe, you don't want to mix up posix and eCos primitives in the
same thread. It is OK to have one set of threads using eCos primitives
and another set of threads using POSIX threads.

Does this answer your question?

     Andrew

-- 
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]