public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Using a Mix of Posix and native calls.
@ 2007-04-26  4:20 Venkateswara Rao L.
  2007-04-26  9:50 ` Nick Garnett
  0 siblings, 1 reply; 2+ messages in thread
From: Venkateswara Rao L. @ 2007-04-26  4:20 UTC (permalink / raw)
  To: ecos-discuss

Hi,

I've just started working on ecos.  I've a basic query.

 

Suppose, we use ecos native call(cyg_thread_create) to create a
task(TASK A).  We have another timer task that implements the software
timers. 

We have a func. timerAdd(), that sets the timeout call. It uses
pthread_cleanup_push with actual "internal timer add function" as
argument, followed by pthread_cleanup_pop(1) to execute the registered
handler. The function timerAdd()  is called in the context of TASK A.
We are getting exception while executing pthread push and pop
instructions.  It looks to me that this exception might be happening
because the task which makes a call to the above mentioned posix calls,
was not created using posix pthread routines.   

 

Is my understanding correct? Can we have a mix of posix and native calls
under some conditions?

 

 

Warm Regards
Venkateswara Rao.
-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] Using a Mix of Posix and native calls.
  2007-04-26  4:20 [ECOS] Using a Mix of Posix and native calls Venkateswara Rao L.
@ 2007-04-26  9:50 ` Nick Garnett
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Garnett @ 2007-04-26  9:50 UTC (permalink / raw)
  To: Venkateswara Rao L.; +Cc: ecos-discuss

"Venkateswara Rao L." <lvenkat@lvl7.com> writes:

> Hi,
> 
> I've just started working on ecos.  I've a basic query.
> 
>  
> 
> Suppose, we use ecos native call(cyg_thread_create) to create a
> task(TASK A).  We have another timer task that implements the software
> timers. 
> 
> We have a func. timerAdd(), that sets the timeout call. It uses
> pthread_cleanup_push with actual "internal timer add function" as
> argument, followed by pthread_cleanup_pop(1) to execute the registered
> handler. The function timerAdd()  is called in the context of TASK A.
> We are getting exception while executing pthread push and pop
> instructions.  It looks to me that this exception might be happening
> because the task which makes a call to the above mentioned posix calls,
> was not created using posix pthread routines.   
> 
>  
> 
> Is my understanding correct? Can we have a mix of posix and native calls
> under some conditions?

In general, you can call non-POSIX functions from POSIX threads, but
you cannot call POSIX functions from non-POSIX threads. This is
because POSIX threads have extra state associated with them such as
signal masks, per-thread data, and the root of the cleanup stack. This
latter item is what was missing when you attempted to use
pthread_cleanup_* from an non-POSIX thread. So you need to make that
thread a POSIX thread.


-- 
Nick Garnett                                     eCos Kernel Architect
eCosCentric Limited     http://www.eCosCentric.com/   The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.    Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-04-26  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-26  4:20 [ECOS] Using a Mix of Posix and native calls Venkateswara Rao L.
2007-04-26  9:50 ` Nick Garnett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).