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 ) {
|
switch ( location ) {
|
||||||
|
|
||||||
case OBJECTS_LOCAL:
|
case OBJECTS_LOCAL:
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
_Thread_Dispatch_disable();
|
||||||
|
#endif
|
||||||
executing = _Thread_Executing;
|
executing = _Thread_Executing;
|
||||||
_CORE_mutex_Seize(
|
_CORE_mutex_Seize(
|
||||||
&the_mutex->Mutex,
|
&the_mutex->Mutex,
|
||||||
@@ -63,6 +66,9 @@ int _POSIX_Mutex_Lock_support(
|
|||||||
timeout,
|
timeout,
|
||||||
&lock_context
|
&lock_context
|
||||||
);
|
);
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
#endif
|
||||||
_Objects_Put_for_get_isr_disable( &the_mutex->Object );
|
_Objects_Put_for_get_isr_disable( &the_mutex->Object );
|
||||||
return _POSIX_Mutex_Translate_core_mutex_return_code(
|
return _POSIX_Mutex_Translate_core_mutex_return_code(
|
||||||
(CORE_mutex_Status) executing->Wait.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;
|
attribute_set = the_semaphore->attribute_set;
|
||||||
wait = !_Options_Is_no_wait( option_set );
|
wait = !_Options_Is_no_wait( option_set );
|
||||||
#if defined(RTEMS_SMP)
|
#if defined(RTEMS_SMP)
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
|
if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
|
||||||
MRSP_Status mrsp_status;
|
MRSP_Status mrsp_status;
|
||||||
|
|
||||||
@@ -66,6 +67,7 @@ rtems_status_code rtems_semaphore_obtain(
|
|||||||
wait,
|
wait,
|
||||||
timeout
|
timeout
|
||||||
);
|
);
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
||||||
return _Semaphore_Translate_MRSP_status_code( mrsp_status );
|
return _Semaphore_Translate_MRSP_status_code( mrsp_status );
|
||||||
} else
|
} else
|
||||||
@@ -79,6 +81,9 @@ rtems_status_code rtems_semaphore_obtain(
|
|||||||
timeout,
|
timeout,
|
||||||
&lock_context
|
&lock_context
|
||||||
);
|
);
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
#endif
|
||||||
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
||||||
return _Semaphore_Translate_core_mutex_return_code(
|
return _Semaphore_Translate_core_mutex_return_code(
|
||||||
executing->Wait.return_code );
|
executing->Wait.return_code );
|
||||||
@@ -93,6 +98,9 @@ rtems_status_code rtems_semaphore_obtain(
|
|||||||
timeout,
|
timeout,
|
||||||
&lock_context
|
&lock_context
|
||||||
);
|
);
|
||||||
|
#if defined(RTEMS_SMP)
|
||||||
|
_Thread_Enable_dispatch();
|
||||||
|
#endif
|
||||||
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
_Objects_Put_for_get_isr_disable( &the_semaphore->Object );
|
||||||
return _Semaphore_Translate_core_semaphore_return_code(
|
return _Semaphore_Translate_core_semaphore_return_code(
|
||||||
executing->Wait.return_code );
|
executing->Wait.return_code );
|
||||||
|
|||||||
@@ -1093,9 +1093,6 @@ RTEMS_INLINE_ROUTINE void _Objects_Put_for_get_isr_disable(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
(void) the_object;
|
(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;
|
index = id - information->minimum_id + 1;
|
||||||
|
|
||||||
if ( information->maximum >= index ) {
|
if ( information->maximum >= index ) {
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
_Thread_Disable_dispatch();
|
|
||||||
#endif
|
|
||||||
_ISR_lock_ISR_disable( lock_context );
|
_ISR_lock_ISR_disable( lock_context );
|
||||||
if ( (the_object = information->local_table[ index ]) != NULL ) {
|
if ( (the_object = information->local_table[ index ]) != NULL ) {
|
||||||
*location = OBJECTS_LOCAL;
|
*location = OBJECTS_LOCAL;
|
||||||
return the_object;
|
return the_object;
|
||||||
}
|
}
|
||||||
_ISR_lock_ISR_enable( lock_context );
|
_ISR_lock_ISR_enable( lock_context );
|
||||||
#if defined(RTEMS_SMP)
|
|
||||||
_Thread_Enable_dispatch();
|
|
||||||
#endif
|
|
||||||
*location = OBJECTS_ERROR;
|
*location = OBJECTS_ERROR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user