This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: question about the posix package
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Stefano Martini <martini at sci dot univr dot it>
- Cc: ecos-discuss at sources dot redhat dot com
- Date: Mon, 29 Dec 2003 22:01:53 +0100
- Subject: Re: [ECOS] question about the posix package
- References: <4088.80.20.85.136.1072693742.squirrel@profs.sci.univr.it>
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