From 5870ac55678115857215a4199f519263599ee341 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 5 Jan 2000 22:19:21 +0000 Subject: Added support for simple binary semaphores in addition to the high power binary/mutex style semaphores already supported by RTEMS. This was done at the request of Eric Norum in support of his effort to port EPICS to RTEMS. This change consisted of changing the nesting_allowed boolean into a lock_nesting_behavior enumerated value as well as allowing the core mutex object to optionally support ensuring that the holder of a binary semaphore released it. Finally, a more subtle enhancement was to allow the non-holder to release a priority inheritance/ceiling mutex and still allow the holding task to return to its original priority. --- cpukit/score/include/rtems/score/coremutex.h | 36 +++++++++++++++++++++++++--- cpukit/score/include/rtems/score/interr.h | 3 ++- 2 files changed, 35 insertions(+), 4 deletions(-) (limited to 'cpukit/score/include') diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index 73f92c76e0..32e4f40b5e 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -62,6 +62,35 @@ typedef enum { CORE_MUTEX_STATUS_CEILING_VIOLATED } CORE_mutex_Status; +/* + * Mutex lock nesting behavior + * + * CORE_MUTEX_NESTING_ACQUIRES: + * This sequence has no blocking or errors: + * lock(m) + * lock(m) + * unlock(m) + * unlock(m) + * + * CORE_MUTEX_NESTING_IS_ERROR + * This sequence returns an error at the indicated point: + * lock(m) + * lock(m) - already locked error + * unlock(m) + * + * CORE_MUTEX_NESTING_BLOCKS + * This sequence performs as indicated: + * lock(m) + * lock(m) - deadlocks or timeouts + * unlock(m) - releases + */ + +typedef enum { + CORE_MUTEX_NESTING_ACQUIRES, + CORE_MUTEX_NESTING_IS_ERROR, + CORE_MUTEX_NESTING_BLOCKS +} CORE_mutex_Nesting_behaviors; + /* * Locked and unlocked values */ @@ -75,9 +104,10 @@ typedef enum { */ typedef struct { - boolean allow_nesting; - CORE_mutex_Disciplines discipline; - Priority_Control priority_ceiling; + CORE_mutex_Nesting_behaviors lock_nesting_behavior; + boolean only_owner_release; + CORE_mutex_Disciplines discipline; + Priority_Control priority_ceiling; } CORE_mutex_Attributes; /* diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index b2e92906fe..293957ec2b 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -53,7 +53,8 @@ typedef enum { INTERNAL_ERROR_OUT_OF_GLOBAL_OBJECTS, INTERNAL_ERROR_OUT_OF_PROXIES, INTERNAL_ERROR_INVALID_GLOBAL_ID, - INTERNAL_ERROR_BAD_STACK_HOOK + INTERNAL_ERROR_BAD_STACK_HOOK, + INTERNAL_ERROR_BAD_ATTRIBUTES } Internal_errors_Core_list; /* -- cgit v1.2.3