Switched to using isr disable version of _Objects_Get. When the

semaphore/mutex can be obtained immediately, this cuts execution time
by 50%.
This commit is contained in:
Joel Sherrill
2000-07-06 19:40:58 +00:00
parent d058ce2ef3
commit 9d27732222
2 changed files with 30 additions and 26 deletions

View File

@@ -70,8 +70,9 @@ rtems_status_code rtems_semaphore_obtain(
register Semaphore_Control *the_semaphore; register Semaphore_Control *the_semaphore;
Objects_Locations location; Objects_Locations location;
boolean wait; boolean wait;
ISR_Level level;
the_semaphore = _Semaphore_Get( id, &location ); the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
@@ -97,23 +98,24 @@ rtems_status_code rtems_semaphore_obtain(
&the_semaphore->Core_control.mutex, &the_semaphore->Core_control.mutex,
id, id,
wait, wait,
timeout timeout,
level
); );
_Thread_Enable_dispatch();
return _Semaphore_Translate_core_mutex_return_code( return _Semaphore_Translate_core_mutex_return_code(
_Thread_Executing->Wait.return_code ); _Thread_Executing->Wait.return_code );
} else { }
_CORE_semaphore_Seize(
/* must be a counting semaphore */
_CORE_semaphore_Seize_isr_disable(
&the_semaphore->Core_control.semaphore, &the_semaphore->Core_control.semaphore,
id, id,
wait, wait,
timeout timeout,
&level
); );
_Thread_Enable_dispatch();
return _Semaphore_Translate_core_semaphore_return_code( return _Semaphore_Translate_core_semaphore_return_code(
_Thread_Executing->Wait.return_code ); _Thread_Executing->Wait.return_code );
} }
}
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
} }

View File

@@ -70,8 +70,9 @@ rtems_status_code rtems_semaphore_obtain(
register Semaphore_Control *the_semaphore; register Semaphore_Control *the_semaphore;
Objects_Locations location; Objects_Locations location;
boolean wait; boolean wait;
ISR_Level level;
the_semaphore = _Semaphore_Get( id, &location ); the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level );
switch ( location ) { switch ( location ) {
case OBJECTS_REMOTE: case OBJECTS_REMOTE:
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
@@ -97,23 +98,24 @@ rtems_status_code rtems_semaphore_obtain(
&the_semaphore->Core_control.mutex, &the_semaphore->Core_control.mutex,
id, id,
wait, wait,
timeout timeout,
level
); );
_Thread_Enable_dispatch();
return _Semaphore_Translate_core_mutex_return_code( return _Semaphore_Translate_core_mutex_return_code(
_Thread_Executing->Wait.return_code ); _Thread_Executing->Wait.return_code );
} else { }
_CORE_semaphore_Seize(
/* must be a counting semaphore */
_CORE_semaphore_Seize_isr_disable(
&the_semaphore->Core_control.semaphore, &the_semaphore->Core_control.semaphore,
id, id,
wait, wait,
timeout timeout,
&level
); );
_Thread_Enable_dispatch();
return _Semaphore_Translate_core_semaphore_return_code( return _Semaphore_Translate_core_semaphore_return_code(
_Thread_Executing->Wait.return_code ); _Thread_Executing->Wait.return_code );
} }
}
return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */
} }