summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-06 19:40:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-07-06 19:40:58 +0000
commit9d27732222a65e46ba146a2c823779924b3be642 (patch)
treeb370fa4e1964121fbac64052ed238f816bb948fc
parentAdded _Semaphore_Get_interrupt_disable. (diff)
downloadrtems-9d27732222a65e46ba146a2c823779924b3be642.tar.bz2
Switched to using isr disable version of _Objects_Get. When the
semaphore/mutex can be obtained immediately, this cuts execution time by 50%.
-rw-r--r--c/src/exec/rtems/src/semobtain.c28
-rw-r--r--cpukit/rtems/src/semobtain.c28
2 files changed, 30 insertions, 26 deletions
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 */
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index fef659d3cb..997b1b12ab 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/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 */