forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user