summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/semobtain.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/rtems/src/semobtain.c')
-rw-r--r--cpukit/rtems/src/semobtain.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/cpukit/rtems/src/semobtain.c b/cpukit/rtems/src/semobtain.c
index c9433ca6d9..3608a00053 100644
--- a/cpukit/rtems/src/semobtain.c
+++ b/cpukit/rtems/src/semobtain.c
@@ -41,6 +41,7 @@ rtems_status_code rtems_semaphore_obtain(
Objects_Locations location;
ISR_Level level;
Thread_Control *executing;
+ rtems_attribute attribute_set;
bool wait;
the_semaphore = _Semaphore_Get_interrupt_disable( id, &location, &level );
@@ -48,8 +49,24 @@ rtems_status_code rtems_semaphore_obtain(
case OBJECTS_LOCAL:
executing = _Thread_Executing;
+ attribute_set = the_semaphore->attribute_set;
wait = !_Options_Is_no_wait( option_set );
- if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) {
+#if defined(RTEMS_SMP)
+ if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
+ MRSP_Status mrsp_status;
+
+ _ISR_Enable( level );
+ mrsp_status = _MRSP_Obtain(
+ &the_semaphore->Core_control.mrsp,
+ executing,
+ wait,
+ timeout
+ );
+ _Objects_Put_for_get_isr_disable( &the_semaphore->Object );
+ return _Semaphore_Translate_MRSP_status_code( mrsp_status );
+ } else
+#endif
+ if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
_CORE_mutex_Seize(
&the_semaphore->Core_control.mutex,
executing,