2008-01-29 Jennifer Averett <jennifer.averett@OARcorp.com>

* score/src/corerwlockrelease.c, score/src/coresemseize.c: Changed
	switch statements to if statements.
This commit is contained in:
Jennifer Averett
2008-01-29 18:59:00 +00:00
parent b7bc1d1a62
commit 1ff7e1948e
3 changed files with 47 additions and 44 deletions

View File

@@ -1,3 +1,8 @@
2008-01-29 Jennifer Averett <jennifer.averett@OARcorp.com>
* score/src/corerwlockrelease.c, score/src/coresemseize.c: Changed
switch statements to if statements.
2008-01-29 Joel Sherrill <joel.sherrill@OARcorp.com> 2008-01-29 Joel Sherrill <joel.sherrill@OARcorp.com>
* libcsupport/Makefile.am, libcsupport/include/rtems/malloc.h, * libcsupport/Makefile.am, libcsupport/include/rtems/malloc.h,

View File

@@ -49,26 +49,23 @@ CORE_RWLock_Status _CORE_RWLock_Release(
*/ */
_ISR_Disable( level ); _ISR_Disable( level );
switch ( the_rwlock->current_state ) { if ( the_rwlock->current_state == CORE_RWLOCK_UNLOCKED){
case CORE_RWLOCK_UNLOCKED:
_ISR_Enable( level ); _ISR_Enable( level );
executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE; executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE;
return CORE_RWLOCK_SUCCESSFUL; return CORE_RWLOCK_SUCCESSFUL;
}
case CORE_RWLOCK_LOCKED_FOR_READING: if ( the_rwlock->current_state == CORE_RWLOCK_LOCKED_FOR_READING ) {
the_rwlock->number_of_readers -= 1; the_rwlock->number_of_readers -= 1;
if ( the_rwlock->number_of_readers != 0 ) { if ( the_rwlock->number_of_readers != 0 ) {
/* must be unlocked again */ /* must be unlocked again */
_ISR_Enable( level ); _ISR_Enable( level );
return CORE_RWLOCK_SUCCESSFUL; return CORE_RWLOCK_SUCCESSFUL;
} }
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
break;
case CORE_RWLOCK_LOCKED_FOR_WRITING:
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
break;
} }
/* CORE_RWLOCK_LOCKED_FOR_WRITING or READING with readers */
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
/* /*
* Implicitly transition to "unlocked" and find another thread interested * Implicitly transition to "unlocked" and find another thread interested
* in obtaining this rwlock. * in obtaining this rwlock.
@@ -102,6 +99,7 @@ CORE_RWLock_Status _CORE_RWLock_Release(
_Thread_queue_Extract( &the_rwlock->Wait_queue, next ); _Thread_queue_Extract( &the_rwlock->Wait_queue, next );
} }
} }
/* indentation is to match _ISR_Disable at top */ /* indentation is to match _ISR_Disable at top */
return CORE_RWLOCK_SUCCESSFUL; return CORE_RWLOCK_SUCCESSFUL;

View File

@@ -69,23 +69,23 @@ void _CORE_semaphore_Seize(
return; return;
} }
switch ( wait ) { if ( wait == CORE_SEMAPHORE_NO_WAIT ) {
case CORE_SEMAPHORE_NO_WAIT:
_ISR_Enable( level ); _ISR_Enable( level );
executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT; executing->Wait.return_code = CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT;
return; return;
case CORE_SEMAPHORE_BAD_TIMEOUT: }
if (wait == CORE_SEMAPHORE_BAD_TIMEOUT ) {
_ISR_Enable( level ); _ISR_Enable( level );
executing->Wait.return_code = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE; executing->Wait.return_code = CORE_SEMAPHORE_BAD_TIMEOUT_VALUE;
return; return;
case CORE_SEMAPHORE_BLOCK_FOREVER: }
case CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT: if (( wait == CORE_SEMAPHORE_BLOCK_FOREVER) ||
( wait == CORE_SEMAPHORE_BLOCK_WITH_TIMEOUT ) ) {
_Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue ); _Thread_queue_Enter_critical_section( &the_semaphore->Wait_queue );
executing->Wait.queue = &the_semaphore->Wait_queue; executing->Wait.queue = &the_semaphore->Wait_queue;
executing->Wait.id = id; executing->Wait.id = id;
_ISR_Enable( level ); _ISR_Enable( level );
_Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout ); _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
break;
} }
} }