public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] POSIX timer_create
@ 2004-09-13 19:51 Devaughn, Hans
  2004-09-14 10:00 ` Nick Garnett
  0 siblings, 1 reply; 5+ messages in thread
From: Devaughn, Hans @ 2004-09-13 19:51 UTC (permalink / raw)
  To: 'ecos-discuss@ecos.sourceware.org'

The POSIX function timer_create has a parameter (struct sigevent *evp) which
allows a "user event handler".

The POSIX module, time.cxx, handles a timeout of the a timer in function
alarm_action. This function checks for SIGEV_SIGNAL and SIGEV_THREAD. The
latter, SIGEV_THREAD, has a comment "FIXME: implement SIGEV_THREAD". 

I am assuming the SIGEV_THREAD is the option for the user event handler. 

My question - Has anyone implemented this POSIX feature? If not, is there
any other way to do this other than using eCos alarms?

Thanks
Hans



-- 
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] 5+ messages in thread

* Re: [ECOS] POSIX timer_create
  2004-09-13 19:51 [ECOS] POSIX timer_create Devaughn, Hans
@ 2004-09-14 10:00 ` Nick Garnett
  0 siblings, 0 replies; 5+ messages in thread
From: Nick Garnett @ 2004-09-14 10:00 UTC (permalink / raw)
  To: Devaughn, Hans; +Cc: 'ecos-discuss@ecos.sourceware.org'

"Devaughn, Hans" <hans.devaughn@siemens.com> writes:

> The POSIX function timer_create has a parameter (struct sigevent *evp) which
> allows a "user event handler".
> 
> The POSIX module, time.cxx, handles a timeout of the a timer in function
> alarm_action. This function checks for SIGEV_SIGNAL and SIGEV_THREAD. The
> latter, SIGEV_THREAD, has a comment "FIXME: implement SIGEV_THREAD". 
> 
> I am assuming the SIGEV_THREAD is the option for the user event handler. 

SIGEV_THREAD means "Create a new thread and call the notify function
on it". This is expensive, complicated and full of potential pitfalls,
so we have not implemented it.

Where does this reference to a "user event handler" come from? As far
as I am aware, POSIX only defines the SIGEV_SIGNAL and SIGEV_THREAD
events.

> 
> My question - Has anyone implemented this POSIX feature? If not, is there
> any other way to do this other than using eCos alarms?

As far as POSIX timers are concerned, delivering a signal is the
only mechanism currently supported. Why is that no suitable? Mixing
POSIX and non-POSIX features can be dangerous.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
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] 5+ messages in thread

* Re: [ECOS] POSIX timer_create
  2004-09-14 11:00 Devaughn, Hans
  2004-09-14 13:30 ` Andrew Lunn
@ 2004-09-14 17:22 ` Nick Garnett
  1 sibling, 0 replies; 5+ messages in thread
From: Nick Garnett @ 2004-09-14 17:22 UTC (permalink / raw)
  To: Devaughn, Hans; +Cc: 'ecos-discuss@ecos.sourceware.org'

"Devaughn, Hans" <hans.devaughn@siemens.com> writes:

> Nick,
> 
> Thanks for your reply. 
> 
> We are operating a process control environment where we have a number of
> threads which are operating as finite state machines. These threads take in
> requests through a mailbox, process them and sometimes wait for a response
> from another application either on-board or off-board. In the meantime these
> threads must be available to handle additional real-time requests.
> Typically, when we get a request that requires a response we will start a
> fail-safe timer. Either we get the response or a timeout. It is this timer
> that I am trying to implement. 
> 
> The problem with signals is that the thread must wait for the signal and the
> thread becomes blocked.

If you set the thread signal masks correctly then the timer's signal
will be delivered just one thread and break it out of any wait it is
in.

Alternatively, why not just add some extra threads to handle the
realtime requests and leave the FSM threads alone. Or are the realtime
requests meant to feed into the FSMs in some way?

> The IEEE specifications has a member of the sigevent structure defined as
> "void(*)(unsigned sigval) sigev_notify_function Notification function". This
> is the option I had hoped to use.

This is the entry function for the thread that SIGEV_THREAD creates. 

> 
> I don't see any way to use the POSIX timers. If we were use the eCos Alarms
> what kind of problems would we be facing? The threads will be created using
> the eCos functions as the POSIX thread functions don't allow us some of the
> functionality we need.

I believe that the POSIX timers will be able to do what you want. You
just have to manipulate the signal masks to steer the timeout signals
to the correct threads.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts


-- 
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] 5+ messages in thread

* Re: [ECOS] POSIX timer_create
  2004-09-14 11:00 Devaughn, Hans
@ 2004-09-14 13:30 ` Andrew Lunn
  2004-09-14 17:22 ` Nick Garnett
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2004-09-14 13:30 UTC (permalink / raw)
  To: Devaughn, Hans; +Cc: 'ecos-discuss@ecos.sourceware.org'

On Tue, Sep 14, 2004 at 04:00:12AM -0700, Devaughn, Hans wrote:
> Nick,
> 
> Thanks for your reply. 
> 
> We are operating a process control environment where we have a number of
> threads which are operating as finite state machines. These threads take in
> requests through a mailbox, process them and sometimes wait for a response
> from another application either on-board or off-board. In the meantime these
> threads must be available to handle additional real-time requests.
> Typically, when we get a request that requires a response we will start a
> fail-safe timer. Either we get the response or a timeout. It is this timer
> that I am trying to implement. 
> 
> The problem with signals is that the thread must wait for the signal and the
> thread becomes blocked.
> 
> The IEEE specifications has a member of the sigevent structure defined as
> "void(*)(unsigned sigval) sigev_notify_function Notification function". This
> is the option I had hoped to use.
> 
> I don't see any way to use the POSIX timers. If we were use the eCos Alarms
> what kind of problems would we be facing? The threads will be created using
> the eCos functions as the POSIX thread functions don't allow us some of the
> functionality we need.

Why not have a timer thread that just sends another signal to the
thread when its timeout occurs?

        Andrew

-- 
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] 5+ messages in thread

* RE: [ECOS] POSIX timer_create
@ 2004-09-14 11:00 Devaughn, Hans
  2004-09-14 13:30 ` Andrew Lunn
  2004-09-14 17:22 ` Nick Garnett
  0 siblings, 2 replies; 5+ messages in thread
From: Devaughn, Hans @ 2004-09-14 11:00 UTC (permalink / raw)
  To: 'Nick Garnett'; +Cc: 'ecos-discuss@ecos.sourceware.org'

Nick,

Thanks for your reply. 

We are operating a process control environment where we have a number of
threads which are operating as finite state machines. These threads take in
requests through a mailbox, process them and sometimes wait for a response
from another application either on-board or off-board. In the meantime these
threads must be available to handle additional real-time requests.
Typically, when we get a request that requires a response we will start a
fail-safe timer. Either we get the response or a timeout. It is this timer
that I am trying to implement. 

The problem with signals is that the thread must wait for the signal and the
thread becomes blocked.

The IEEE specifications has a member of the sigevent structure defined as
"void(*)(unsigned sigval) sigev_notify_function Notification function". This
is the option I had hoped to use.

I don't see any way to use the POSIX timers. If we were use the eCos Alarms
what kind of problems would we be facing? The threads will be created using
the eCos functions as the POSIX thread functions don't allow us some of the
functionality we need.

Hans
 

-----Original Message-----
From: nickg@xl5.calivar.com [mailto:nickg@xl5.calivar.com] On Behalf Of Nick
Garnett
Sent: Tuesday, September 14, 2004 6:00 AM
To: Devaughn, Hans
Cc: 'ecos-discuss@ecos.sourceware.org'
Subject: Re: [ECOS] POSIX timer_create


"Devaughn, Hans" <hans.devaughn@siemens.com> writes:

> The POSIX function timer_create has a parameter (struct sigevent *evp) 
> which allows a "user event handler".
> 
> The POSIX module, time.cxx, handles a timeout of the a timer in 
> function alarm_action. This function checks for SIGEV_SIGNAL and 
> SIGEV_THREAD. The latter, SIGEV_THREAD, has a comment "FIXME: 
> implement SIGEV_THREAD".
> 
> I am assuming the SIGEV_THREAD is the option for the user event 
> handler.

SIGEV_THREAD means "Create a new thread and call the notify function on it".
This is expensive, complicated and full of potential pitfalls, so we have
not implemented it.

Where does this reference to a "user event handler" come from? As far as I
am aware, POSIX only defines the SIGEV_SIGNAL and SIGEV_THREAD events.

> 
> My question - Has anyone implemented this POSIX feature? If not, is 
> there any other way to do this other than using eCos alarms?

As far as POSIX timers are concerned, delivering a signal is the only
mechanism currently supported. Why is that no suitable? Mixing POSIX and
non-POSIX features can be dangerous.


-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com/     The eCos and RedBoot experts

-- 
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] 5+ messages in thread

end of thread, other threads:[~2004-09-14 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-13 19:51 [ECOS] POSIX timer_create Devaughn, Hans
2004-09-14 10:00 ` Nick Garnett
2004-09-14 11:00 Devaughn, Hans
2004-09-14 13:30 ` Andrew Lunn
2004-09-14 17:22 ` 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).