diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-01-05 22:19:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2000-01-05 22:19:21 +0000 |
commit | 5870ac55678115857215a4199f519263599ee341 (patch) | |
tree | 8b6f044ae7cccc3da9a3bd69b2468c2ca77acff8 /cpukit/score/src/coremutexseize.c | |
parent | Updated to reflect a time that had previously been left out due to (diff) | |
download | rtems-5870ac55678115857215a4199f519263599ee341.tar.bz2 |
Added support for simple binary semaphores in addition to the high
power binary/mutex style semaphores already supported by RTEMS. This
was done at the request of Eric Norum <eric@cls.usask.ca> in support
of his effort to port EPICS to RTEMS. This change consisted of
changing the nesting_allowed boolean into a lock_nesting_behavior
enumerated value as well as allowing the core mutex object to optionally
support ensuring that the holder of a binary semaphore released it.
Finally, a more subtle enhancement was to allow the non-holder to release
a priority inheritance/ceiling mutex and still allow the holding task
to return to its original priority.
Diffstat (limited to 'cpukit/score/src/coremutexseize.c')
-rw-r--r-- | cpukit/score/src/coremutexseize.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c index c2a70da762..db576c6ef1 100644 --- a/cpukit/score/src/coremutexseize.c +++ b/cpukit/score/src/coremutexseize.c @@ -94,15 +94,19 @@ void _CORE_mutex_Seize( return; } - if ( _Objects_Are_ids_equal( - _Thread_Executing->Object.id, the_mutex->holder_id ) ) { - if ( _CORE_mutex_Is_nesting_allowed( &the_mutex->Attributes ) ) - the_mutex->nest_count++; - else - executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; - - _ISR_Enable( level ); - return; + if ( _Thread_Is_executing( the_mutex->holder ) ) { + switch ( the_mutex->Attributes.lock_nesting_behavior ) { + case CORE_MUTEX_NESTING_ACQUIRES: + the_mutex->nest_count++; + _ISR_Enable( level ); + return; + case CORE_MUTEX_NESTING_IS_ERROR: + executing->Wait.return_code = CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; + _ISR_Enable( level ); + return; + case CORE_MUTEX_NESTING_BLOCKS: + break; + } } if ( !wait ) { |