rtems_event_receive() return code question
Thomas Rauscher
trauscher at loytec.com
Mon Feb 2 16:57:37 UTC 2004
Hi,
I've a question regarding the rtems_event_receive() semantics.
The API documentation unfortunately leaves some open questions.
If a rtems_event_receive() function is called with timeout, but
receives events just while returning after a timeout, is it correct to
return RTEMS_TIMEOUT but have the event_out parameter set to
a satisfying event set?
I can reproduce this behavior when
1) A thread calls rtems_event_receive with a timeout of one system tick
2) A hardware timer generates interrupts at a frequency higher than
the system tick.
3) The hardware timer ISR sends an event to the waiting task.
A scan through the event code (CVS head of 2004-02-02)
makes me believe that it's possible, as _Event_Timeout()
does not clear the waiting condition. An _Event_Surrender()
call could be executed between the following two statements
in rtems_event_receive():
_Thread_Enable_dispatch();
return( _Thread_Executing->Wait.return_code );
Then the return code would be RTEMS_TIMEOUT, but a satisfying
event set would be found in *event_out.
The effect is highly volatile to timing.
Any comments would be highly appreciated.
Thanks in advance,
Thomas
--
Thomas Rauscher
LOYTEC electronics GmbH
Stolzenthalergasse 24/3
A-1080 Wien
Austria/Europe
trauscher at loytec.com
www.loytec.com
Phone: +43-1-4020805-15
FAX: +43-1-4020805-99
More information about the users
mailing list