From 7d91d722baf1f1ff275fd31500526bb2fd6df632 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 13 Dec 1999 15:29:20 +0000 Subject: First attempt at adding simple binary semaphore in addition to the current "mutex" and counting semaphore. This is at the request of Eric Norum and his EPICS porting effort. --- cpukit/rtems/src/semcreate.c | 9 ++++++--- cpukit/rtems/src/semtranslatereturncode.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'cpukit/rtems/src') diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c index 84a960f5b2..a63814acfe 100644 --- a/cpukit/rtems/src/semcreate.c +++ b/cpukit/rtems/src/semcreate.c @@ -129,14 +129,17 @@ rtems_status_code rtems_semaphore_create( if ( _Attributes_Is_binary_semaphore( attribute_set ) ) { if ( _Attributes_Is_inherit_priority( attribute_set ) ) the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT; - else if (_Attributes_Is_priority_ceiling( attribute_set ) ) + else if ( _Attributes_Is_priority_ceiling( attribute_set ) ) the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING; - else if (_Attributes_Is_priority( attribute_set ) ) + else if ( _Attributes_Is_priority( attribute_set ) ) the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_PRIORITY; else the_mutex_attributes.discipline = CORE_MUTEX_DISCIPLINES_FIFO; - the_mutex_attributes.allow_nesting = TRUE; + if ( _Attributes_Is_nesting_allowed( attribute_set ) ) + the_mutex_attributes.allow_nesting = TRUE; + else + the_mutex_attributes.allow_nesting = FALSE; /* Add priority ceiling code here ????? */ diff --git a/cpukit/rtems/src/semtranslatereturncode.c b/cpukit/rtems/src/semtranslatereturncode.c index 0f9bf7d3f5..adae1df600 100644 --- a/cpukit/rtems/src/semtranslatereturncode.c +++ b/cpukit/rtems/src/semtranslatereturncode.c @@ -67,7 +67,7 @@ rtems_status_code _Semaphore_Translate_core_mutex_return_code ( case CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT: return RTEMS_UNSATISFIED; case CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED: - return RTEMS_INTERNAL_ERROR; + return RTEMS_UNSATISFIED; case CORE_MUTEX_STATUS_NOT_OWNER_OF_RESOURCE: return RTEMS_NOT_OWNER_OF_RESOURCE; case CORE_MUTEX_WAS_DELETED: -- cgit v1.2.3