diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-20 08:52:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2015-04-21 08:25:31 +0200 |
commit | 3bf4a9fac441f90ccb79da69c67974d903da4c1a (patch) | |
tree | dfe9f5a2e0f5ee28d3c0ab346dcfe7a4d4b5ae9a | |
parent | score: _Objects_Get_isr_disable() (diff) | |
download | rtems-3bf4a9fac441f90ccb79da69c67974d903da4c1a.tar.bz2 |
score: _Objects_Get_isr_disable()
Do not disable thread dispatching and do not acquire the Giant lock.
This makes it possible to use this object get variant for fine grained
locking.
Update #2273.
-rw-r--r-- | cpukit/posix/src/mutexlocksupp.c | 6 | ||||
-rw-r--r-- | cpukit/rtems/src/semobtain.c | 8 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/objectimpl.h | 3 | ||||
-rw-r--r-- | cpukit/score/src/objectgetisr.c | 6 |
4 files changed, 14 insertions, 9 deletions
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c index 3678a0b942..92c6556980 100644 --- a/cpukit/posix/src/mutexlocksupp.c +++ b/cpukit/posix/src/mutexlocksupp.c @@ -54,6 +54,9 @@ int _POSIX_Mutex_Lock_support( switch ( location ) { case OBJECTS_LOCAL: +#if defined(RTEMS_SMP) + _Thread_Dispatch_disable(); +#endif executing = _Thread_Executing; _CORE_mutex_Seize( &the_mutex->Mutex, @@ -63,6 +66,9 @@ int _POSIX_Mutex_Lock_support( timeout, &lock_context ); +#if defined(RTEMS_SMP) + _Thread_Enable_dispatch(); +#endif _Objects_Put_for_get_isr_disable( &the_mutex->Object ); return _POSIX_Mutex_Translate_core_mutex_return_code( (CORE_mutex_Status) executing->Wait.return_code diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c index 152274ea0a..0edac96264 100644 --- a/cpukit/rtems/src/semobtain.c +++ b/cpukit/rtems/src/semobtain.c @@ -56,6 +56,7 @@ rtems_status_code rtems_semaphore_obtain( attribute_set = the_semaphore->attribute_set; wait = !_Options_Is_no_wait( option_set ); #if defined(RTEMS_SMP) + _Thread_Disable_dispatch(); if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) { MRSP_Status mrsp_status; @@ -66,6 +67,7 @@ rtems_status_code rtems_semaphore_obtain( wait, timeout ); + _Thread_Enable_dispatch(); _Objects_Put_for_get_isr_disable( &the_semaphore->Object ); return _Semaphore_Translate_MRSP_status_code( mrsp_status ); } else @@ -79,6 +81,9 @@ rtems_status_code rtems_semaphore_obtain( timeout, &lock_context ); +#if defined(RTEMS_SMP) + _Thread_Enable_dispatch(); +#endif _Objects_Put_for_get_isr_disable( &the_semaphore->Object ); return _Semaphore_Translate_core_mutex_return_code( executing->Wait.return_code ); @@ -93,6 +98,9 @@ rtems_status_code rtems_semaphore_obtain( timeout, &lock_context ); +#if defined(RTEMS_SMP) + _Thread_Enable_dispatch(); +#endif _Objects_Put_for_get_isr_disable( &the_semaphore->Object ); return _Semaphore_Translate_core_semaphore_return_code( executing->Wait.return_code ); diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h index a137deace3..a96dc208ab 100644 --- a/cpukit/score/include/rtems/score/objectimpl.h +++ b/cpukit/score/include/rtems/score/objectimpl.h @@ -1093,9 +1093,6 @@ RTEMS_INLINE_ROUTINE void _Objects_Put_for_get_isr_disable( ) { (void) the_object; -#if defined(RTEMS_SMP) - _Thread_Enable_dispatch(); -#endif } /** diff --git a/cpukit/score/src/objectgetisr.c b/cpukit/score/src/objectgetisr.c index 4feb7aaffb..b1212ac9c7 100644 --- a/cpukit/score/src/objectgetisr.c +++ b/cpukit/score/src/objectgetisr.c @@ -33,18 +33,12 @@ Objects_Control *_Objects_Get_isr_disable( index = id - information->minimum_id + 1; if ( information->maximum >= index ) { -#if defined(RTEMS_SMP) - _Thread_Disable_dispatch(); -#endif _ISR_lock_ISR_disable( lock_context ); if ( (the_object = information->local_table[ index ]) != NULL ) { *location = OBJECTS_LOCAL; return the_object; } _ISR_lock_ISR_enable( lock_context ); -#if defined(RTEMS_SMP) - _Thread_Enable_dispatch(); -#endif *location = OBJECTS_ERROR; return NULL; } |