2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>

* rtems/src/eventseize.c, rtems/src/eventsurrender.c,
	rtems/src/eventtimeout.c: Clean up and minor rework as a side-effect
	of coverage analysis.
This commit is contained in:
Joel Sherrill
2009-07-21 23:09:07 +00:00
parent 7fbe4fa1bf
commit 4b45c1393c
4 changed files with 26 additions and 15 deletions

View File

@@ -1,3 +1,9 @@
2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/src/eventseize.c, rtems/src/eventsurrender.c,
rtems/src/eventtimeout.c: Clean up and minor rework as a side-effect
of coverage analysis.
2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com> 2009-07-21 Joel Sherrill <joel.sherrill@OARcorp.com>
* sapi/src/debug.c, score/include/rtems/debug.h: Rename * sapi/src/debug.c, score/include/rtems/debug.h: Rename

View File

@@ -86,12 +86,20 @@ void _Event_Seize(
return; return;
} }
_Event_Sync_state = THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED; /*
* Note what we are waiting for BEFORE we enter the critical section.
* The interrupt critical section management code needs this to be
* set properly when we are marked as in the event critical section.
*
* NOTE: Since interrupts are disabled, this isn't that much of an
* issue but better safe than sorry.
*/
executing->Wait.option = (uint32_t) option_set; executing->Wait.option = (uint32_t) option_set;
executing->Wait.count = (uint32_t) event_in; executing->Wait.count = (uint32_t) event_in;
executing->Wait.return_argument = event_out; executing->Wait.return_argument = event_out;
_Event_Sync_state = THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED;
_ISR_Enable( level ); _ISR_Enable( level );
if ( ticks ) { if ( ticks ) {

View File

@@ -77,8 +77,8 @@ void _Event_Surrender(
*/ */
if ( _ISR_Is_in_progress() && if ( _ISR_Is_in_progress() &&
_Thread_Is_executing( the_thread ) && _Thread_Is_executing( the_thread ) &&
((_Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) || ((_Event_Sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT) ||
(_Event_Sync_state == THREAD_BLOCKING_OPERATION_TIMEOUT)) ) { (_Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED)) ) {
if ( seized_events == event_condition || _Options_Is_any(option_set) ) { if ( seized_events == event_condition || _Options_Is_any(option_set) ) {
api->pending_events = _Event_sets_Clear( pending_events,seized_events ); api->pending_events = _Event_sets_Clear( pending_events,seized_events );
the_thread->Wait.count = 0; the_thread->Wait.count = 0;

View File

@@ -63,22 +63,19 @@ void _Event_Timeout(
* this is the "timeout" transition. After a request is satisfied, * this is the "timeout" transition. After a request is satisfied,
* a timeout is not allowed to occur. * a timeout is not allowed to occur.
*/ */
_ISR_Disable( level ); _ISR_Disable( level );
if ( !the_thread->Wait.count ) { /* verify thread is waiting */ #if defined(RTEMS_DEBUG)
_Thread_Unnest_dispatch(); if ( !the_thread->Wait.count ) { /* verify thread is waiting */
_ISR_Enable( level ); _Thread_Unnest_dispatch();
return; _ISR_Enable( level );
} return;
}
#endif
the_thread->Wait.count = 0; the_thread->Wait.count = 0;
if ( _Thread_Is_executing( the_thread ) ) { if ( _Thread_Is_executing( the_thread ) ) {
Thread_blocking_operation_States sync = _Event_Sync_state; if ( _Event_Sync_state == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED )
if ( (sync == THREAD_BLOCKING_OPERATION_SYNCHRONIZED) ||
(sync == THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED) ) {
_Event_Sync_state = THREAD_BLOCKING_OPERATION_TIMEOUT; _Event_Sync_state = THREAD_BLOCKING_OPERATION_TIMEOUT;
}
} }
the_thread->Wait.return_code = RTEMS_TIMEOUT; the_thread->Wait.return_code = RTEMS_TIMEOUT;