有时候一个任务可以有多互斥信号量,可以使用这个建立链表。
[C] 纯文本查看 复制代码 /* Define the owned list next and previous pointers. */
struct TX_MUTEX_STRUCT
*tx_mutex_owned_next,
*tx_mutex_owned_previous;
而tx_mutex_created_next建立的链表是将所有创建的互斥信号量建立链表。
[C] 纯文本查看 复制代码 /* Define the mutex structure utilized by the application. */
typedef struct TX_MUTEX_STRUCT
{
/* Define the mutex ID used for error checking. */
ULONG tx_mutex_id;
/* Define the mutex's name. */
CHAR *tx_mutex_name;
/* Define the mutex ownership count. */
UINT tx_mutex_ownership_count;
/* Define the mutex ownership pointer. This pointer points to the
the thread that owns the mutex. */
TX_THREAD *tx_mutex_owner;
/* Define the priority inheritance flag. If this flag is set, priority
inheritance will be in effect. */
UINT tx_mutex_inherit;
/* Define the save area for the owning thread's original priority. */
UINT tx_mutex_original_priority;
/* Define the mutex suspension list head along with a count of
how many threads are suspended. */
struct TX_THREAD_STRUCT
*tx_mutex_suspension_list;
UINT tx_mutex_suspended_count;
/* Define the created list next and previous pointers. */
struct TX_MUTEX_STRUCT
*tx_mutex_created_next,
*tx_mutex_created_previous;
/* Define the priority of the highest priority thread waiting for
this mutex. */
UINT tx_mutex_highest_priority_waiting;
/* Define the owned list next and previous pointers. */
struct TX_MUTEX_STRUCT
*tx_mutex_owned_next,
*tx_mutex_owned_previous;
#ifdef TX_MUTEX_ENABLE_PERFORMANCE_INFO
/* Define the number of mutex puts. */
ULONG tx_mutex_performance_put_count;
/* Define the total number of mutex gets. */
ULONG tx_mutex_performance_get_count;
/* Define the total number of mutex suspensions. */
ULONG tx_mutex_performance_suspension_count;
/* Define the total number of mutex timeouts. */
ULONG tx_mutex_performance_timeout_count;
/* Define the total number of priority inversions. */
ULONG tx_mutex_performance_priority_inversion_count;
/* Define the total number of priority inheritance conditions. */
ULONG tx_mutex_performance__priority_inheritance_count;
#endif
/* Define the port extension in the mutex control block. This
is typically defined to whitespace in tx_port.h. */
TX_MUTEX_EXTENSION
} TX_MUTEX;
|