summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/semobtain.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-01 20:52:51 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:46 +0200
commite76c517d0726f91447e0e2c3ba14c00896456e89 (patch)
treecaa429239407c3cfa4cfd8a4e68aae25e893ca35 /cpukit/rtems/src/semobtain.c
parentscore: Fine grained locking for message queues (diff)
downloadrtems-e76c517d0726f91447e0e2c3ba14c00896456e89.tar.bz2
score: Fine grained locking for semaphores
Update #2273.
Diffstat (limited to 'cpukit/rtems/src/semobtain.c')
-rw-r--r--cpukit/rtems/src/semobtain.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index 0edac96264..ca13bea080 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -56,10 +56,10 @@ 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;
+ _Thread_Disable_dispatch();
_ISR_lock_ISR_enable( &lock_context );
mrsp_status = _MRSP_Obtain(
&the_semaphore->Core_control.mrsp,
@@ -73,6 +73,9 @@ rtems_status_code rtems_semaphore_obtain(
} else
#endif
if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
+#if defined(RTEMS_SMP)
+ _Thread_Disable_dispatch();
+#endif
_CORE_mutex_Seize(
&the_semaphore->Core_control.mutex,
executing,
@@ -98,10 +101,6 @@ 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 );