diff options
author | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-27 18:45:03 +0000 |
---|---|---|
committer | Glenn Humphrey <glenn.humphrey@oarcorp.com> | 2007-11-27 18:45:03 +0000 |
commit | 5d55a0b24273f62970ebb0372fd5ec3881a89731 (patch) | |
tree | dfc38bf3bb7ec9708b5be19d291fa1e336ea58a1 /cpukit | |
parent | 2007-11-27 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-5d55a0b24273f62970ebb0372fd5ec3881a89731.tar.bz2 |
2007-11-27 Glenn Humphrey <glenn.humphrey@OARcorp.com>
* posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c,
rtems/include/rtems/rtems/barrier.h,
score/src/corerwlockobtainread.c, score/src/corerwlockobtainwrite.c,
score/src/corerwlockrelease.c: Fixed several implementation errors.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 7 | ||||
-rw-r--r-- | cpukit/posix/src/prwlocktimedrdlock.c | 2 | ||||
-rw-r--r-- | cpukit/posix/src/prwlocktimedwrlock.c | 2 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/barrier.h | 7 | ||||
-rw-r--r-- | cpukit/score/src/corerwlockobtainread.c | 1 | ||||
-rw-r--r-- | cpukit/score/src/corerwlockobtainwrite.c | 1 | ||||
-rw-r--r-- | cpukit/score/src/corerwlockrelease.c | 47 |
7 files changed, 36 insertions, 31 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 6a9700a5c9..e9d02bee52 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2007-11-27 Glenn Humphrey <glenn.humphrey@OARcorp.com> + + * posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, + rtems/include/rtems/rtems/barrier.h, + score/src/corerwlockobtainread.c, score/src/corerwlockobtainwrite.c, + score/src/corerwlockrelease.c: Fixed several implementation errors. + 2007-11-27 Joel Sherrill <joel.sherrill@oarcorp.com> * sapi/include/confdefs.h: Add CONFIGURE_APPLICATION_EXTRA_DRIVERS. diff --git a/cpukit/posix/src/prwlocktimedrdlock.c b/cpukit/posix/src/prwlocktimedrdlock.c index 2e9d578018..f10ad8f133 100644 --- a/cpukit/posix/src/prwlocktimedrdlock.c +++ b/cpukit/posix/src/prwlocktimedrdlock.c @@ -49,7 +49,7 @@ int pthread_rwlock_timedrdlock( return EINVAL; status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ); - if ( !status ) + if ( status ) return status; the_rwlock = _POSIX_RWLock_Get( rwlock, &location ); diff --git a/cpukit/posix/src/prwlocktimedwrlock.c b/cpukit/posix/src/prwlocktimedwrlock.c index 5a5253ad02..8e026056d5 100644 --- a/cpukit/posix/src/prwlocktimedwrlock.c +++ b/cpukit/posix/src/prwlocktimedwrlock.c @@ -49,7 +49,7 @@ int pthread_rwlock_timedwrlock( return EINVAL; status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ); - if ( !status ) + if ( status ) return status; the_rwlock = _POSIX_RWLock_Get( rwlock, &location ); diff --git a/cpukit/rtems/include/rtems/rtems/barrier.h b/cpukit/rtems/include/rtems/rtems/barrier.h index a00d2d97aa..4d0a57398e 100644 --- a/cpukit/rtems/include/rtems/rtems/barrier.h +++ b/cpukit/rtems/include/rtems/rtems/barrier.h @@ -145,7 +145,6 @@ rtems_status_code rtems_barrier_delete( * clock ticks. * * @param[in] id indicates the barrier to wait at. - * @param[in] option_set indicates if the caller is willing to wait. * @param[in] timeout is the maximum length of time in ticks the calling * thread is willing to block. * @@ -161,17 +160,17 @@ rtems_status_code rtems_barrier_wait( * * This routine implements the rtems_barrier_release directive. It * unblocks all of the threads waiting on the barrier associated with - * @a id. The number of threads unblocked is returns in @a unblocked. + * @a id. The number of threads unblocked is returned in @a released. * * * @param[in] id indicates the barrier to wait at. - * @param[out] unblocked will contain the number of threads unblocked. + * @param[out] released will contain the number of threads unblocked. * * @return a status code indicating success or the reason for failure. */ rtems_status_code rtems_barrier_release( rtems_id id, - uint32_t *unblocked + uint32_t *released ); /** diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c index 724529eef5..21429a5658 100644 --- a/cpukit/score/src/corerwlockobtainread.c +++ b/cpukit/score/src/corerwlockobtainread.c @@ -84,6 +84,7 @@ void _CORE_RWLock_Obtain_for_reading( if ( !wait ) { _ISR_Enable( level ); executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE; + return; } /* diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c index a1535b786f..2d1ff2aa3a 100644 --- a/cpukit/score/src/corerwlockobtainwrite.c +++ b/cpukit/score/src/corerwlockobtainwrite.c @@ -74,6 +74,7 @@ void _CORE_RWLock_Obtain_for_writing( if ( !wait ) { _ISR_Enable( level ); executing->Wait.return_code = CORE_RWLOCK_UNAVAILABLE; + return; } /* diff --git a/cpukit/score/src/corerwlockrelease.c b/cpukit/score/src/corerwlockrelease.c index b9d0e2f9e1..4d29cd0f21 100644 --- a/cpukit/score/src/corerwlockrelease.c +++ b/cpukit/score/src/corerwlockrelease.c @@ -40,7 +40,6 @@ CORE_RWLock_Status _CORE_RWLock_Release( ISR_Level level; Thread_Control *executing = _Thread_Executing; Thread_Control *next; - uint32_t rwmode; /* * If unlocked, then OK to read. @@ -80,32 +79,30 @@ CORE_RWLock_Status _CORE_RWLock_Release( next = _Thread_queue_Dequeue( &the_rwlock->Wait_queue ); if ( next ) { - rwmode = next->Wait.option; - if ( rwmode == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) { - the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING; - return CORE_RWLOCK_SUCCESSFUL; - } - - /* - * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING now see if more - * readers can be let go. - */ - - while ( 1 ) { - next = _Thread_queue_First( &the_rwlock->Wait_queue ); - if ( !next ) - return CORE_RWLOCK_SUCCESSFUL; - if ( next->Wait.option != CORE_RWLOCK_THREAD_WAITING_FOR_READ ) - return CORE_RWLOCK_SUCCESSFUL; - - /* it is definitely wanting to read */ - the_rwlock->number_of_readers += 1; - _Thread_queue_Extract( &the_rwlock->Wait_queue, next ); - } + if ( next->Wait.option == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) { + the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_WRITING; + return CORE_RWLOCK_SUCCESSFUL; + } - /* XXX need to put read/write lock request indicator in Wait info */ + /* + * Must be CORE_RWLOCK_THREAD_WAITING_FOR_READING + */ + the_rwlock->number_of_readers += 1; + the_rwlock->current_state = CORE_RWLOCK_LOCKED_FOR_READING; - } + /* + * Now see if more readers can be let go. + */ + while ( 1 ) { + next = _Thread_queue_First( &the_rwlock->Wait_queue ); + if ( !next || + next->Wait.option == CORE_RWLOCK_THREAD_WAITING_FOR_WRITE ) + return CORE_RWLOCK_SUCCESSFUL; + the_rwlock->number_of_readers += 1; + _Thread_queue_Extract( &the_rwlock->Wait_queue, next ); + } + } + /* indentation is to match _ISR_Disable at top */ return CORE_RWLOCK_SUCCESSFUL; } |