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>
* sapi/src/debug.c, score/include/rtems/debug.h: Rename

View File

@@ -86,12 +86,20 @@ void _Event_Seize(
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.count = (uint32_t) event_in;
executing->Wait.return_argument = event_out;
_Event_Sync_state = THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED;
_ISR_Enable( level );
if ( ticks ) {

View File

@@ -77,8 +77,8 @@ void _Event_Surrender(
*/
if ( _ISR_Is_in_progress() &&
_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) ) {
api->pending_events = _Event_sets_Clear( pending_events,seized_events );
the_thread->Wait.count = 0;

View File

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