From 9d27732222a65e46ba146a2c823779924b3be642 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 6 Jul 2000 19:40:58 +0000 Subject: Switched to using isr disable version of _Objects_Get. When the semaphore/mutex can be obtained immediately, this cuts execution time by 50%. --- c/src/exec/rtems/src/semobtain.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'c/src/exec/rtems/src') diff --git a/c/src/exec/rtems/src/semobtain.c b/c/src/exec/rtems/src/semobtain.c index fef659d3cb..997b1b12ab 100644 --- a/c/src/exec/rtems/src/semobtain.c +++ b/c/src/exec/rtems/src/semobtain.c @@ -70,8 +70,9 @@ rtems_status_code rtems_semaphore_obtain( register Semaphore_Control *the_semaphore; Objects_Locations location; boolean wait; + ISR_Level level; - the_semaphore = _Semaphore_Get( id, &location ); + the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level ); switch ( location ) { case OBJECTS_REMOTE: #if defined(RTEMS_MULTIPROCESSING) @@ -97,22 +98,23 @@ rtems_status_code rtems_semaphore_obtain( &the_semaphore->Core_control.mutex, id, wait, - timeout + timeout, + level ); - _Thread_Enable_dispatch(); return _Semaphore_Translate_core_mutex_return_code( _Thread_Executing->Wait.return_code ); - } else { - _CORE_semaphore_Seize( - &the_semaphore->Core_control.semaphore, - id, - wait, - timeout - ); - _Thread_Enable_dispatch(); - return _Semaphore_Translate_core_semaphore_return_code( - _Thread_Executing->Wait.return_code ); } + + /* must be a counting semaphore */ + _CORE_semaphore_Seize_isr_disable( + &the_semaphore->Core_control.semaphore, + id, + wait, + timeout, + &level + ); + return _Semaphore_Translate_core_semaphore_return_code( + _Thread_Executing->Wait.return_code ); } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ -- cgit v1.2.3