diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-21 15:50:09 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-21 15:50:09 +0000 |
commit | fd84982c0019205ea5e4c226f47dd62480cfd5e6 (patch) | |
tree | b2915444f038f690cd390dfee72cc896319ba7b4 /cpukit/score/include | |
parent | 2007-12-21 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-fd84982c0019205ea5e4c226f47dd62480cfd5e6.tar.bz2 |
2007-12-21 Xi Yang <hiyangxi@gmail.com>
* configure.ac, score/include/rtems/score/coremutex.h,
score/include/rtems/score/thread.h,
score/inline/rtems/score/coremutex.inl,
score/src/coremutexsurrender.c, score/src/threadinitialize.c: Add
support for proper stacking of priority inheritance on mutexes as
well as enforce proper order of release.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r-- | cpukit/score/include/rtems/score/coremutex.h | 37 | ||||
-rw-r--r-- | cpukit/score/include/rtems/score/thread.h | 5 |
2 files changed, 39 insertions, 3 deletions
diff --git a/cpukit/score/include/rtems/score/coremutex.h b/cpukit/score/include/rtems/score/coremutex.h index ee600dcc2e..b61c8476e4 100644 --- a/cpukit/score/include/rtems/score/coremutex.h +++ b/cpukit/score/include/rtems/score/coremutex.h @@ -21,6 +21,7 @@ #ifndef _RTEMS_SCORE_COREMUTEX_H #define _RTEMS_SCORE_COREMUTEX_H + /** * @defgroup ScoreMutex Mutex Handler * @@ -70,7 +71,7 @@ typedef enum { */ CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING } CORE_mutex_Disciplines; - + /** * @brief Mutex method return statuses * @@ -101,10 +102,16 @@ typedef enum { * because the resource never became available. */ CORE_MUTEX_TIMEOUT, +#ifdef __STRICT_ORDER_MUTEX__ + /** This status indicates that a thread not release the mutex which has + * the priority inheritance property in a right order. + */ + CORE_MUTEX_RELEASE_NOT_ORDER, +#endif /** This status indicates that a thread of logically greater importance * than the ceiling priority attempted to lock this mutex. */ - CORE_MUTEX_STATUS_CEILING_VIOLATED + CORE_MUTEX_STATUS_CEILING_VIOLATED, } CORE_mutex_Status; /** @@ -182,6 +189,25 @@ typedef struct { Priority_Control priority_ceiling; } CORE_mutex_Attributes; +#ifdef __STRICT_ORDER_MUTEX__ +/*@brief Core Mutex Lock_Chain Struct + * + * The following defines the control block used to manage lock chain of + * priority inheritance mutex. + */ + typedef struct{ + /** This field is a chian of locked mutex by a thread,new mutex will + * be added to the head of queue, and the mutex which will be released + * must be the head of queue. + */ + Chain_Node lock_queue; + /** This field is the priority of thread before locking this mutex + * + */ + Priority_Control priority_before; + } CORE_mutex_order_list; +#endif + /** * @brief Core Mutex Control Structure * @@ -212,6 +238,11 @@ typedef struct { Thread_Control *holder; /** This element contains the object Id of the holding thread. */ Objects_Id holder_id; +#ifdef __STRICT_ORDER_MUTEX__ + /** This field is used to manipulate the priority inheritance mutex queue. */ + CORE_mutex_order_list queue; +#endif + } CORE_mutex_Control; /** @@ -250,7 +281,7 @@ void _CORE_mutex_Initialize( * @note For performance reasons, this routine is implemented as * a macro that uses two support routines. */ -RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock( +int _CORE_mutex_Seize_interrupt_trylock( CORE_mutex_Control *the_mutex, ISR_Level *level_p ); diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 5bfd4534e9..9b9f324b9e 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -253,6 +253,7 @@ typedef struct { Priority_Control real_priority; /** This field is the number of mutexes currently held by this proxy. */ uint32_t resource_count; + /** This field is the blocking information for this proxy. */ Thread_Wait_information Wait; /** This field is the Watchdog used to manage proxy delays and timeouts. */ @@ -310,6 +311,10 @@ struct Thread_Control_struct { /** This field is the received response packet in an MP system. */ MP_packet_Prefix *receive_packet; #endif +#ifdef __STRICT_ORDER_MUTEX__ + /**This field is the head of queue of priority inheritance mutex holed by the thread*/ + Chain_Control lock_mutex; +#endif /*================= end of common block =================*/ /** This field is the number of nested suspend calls. */ uint32_t suspend_count; |