硬汉嵌入式论坛

 找回密码
 立即注册
查看: 1328|回复: 1
收起左侧

[ThreadX全家桶] ThreadX互斥信号量结构体中的tx_mutex_owned_next用于统计此任务拥有的信号量链表

[复制链接]

1万

主题

7万

回帖

11万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
115863
QQ
发表于 2022-10-14 00:48:23 | 显示全部楼层 |阅读模式
有时候一个任务可以有多互斥信号量,可以使用这个建立链表。   

[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;


回复

使用道具 举报

1

主题

18

回帖

21

积分

新手上路

积分
21
发表于 2022-10-14 14:40:57 | 显示全部楼层
RTX好像也是这个做法
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2025-5-24 02:48 , Processed in 0.242978 second(s), 24 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表