XNSim/Release/include/XNCore/XNThread_p.h

77 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include "XNObject_p.h"
/**
* @brief 线程类私有结构体
*/
struct XNThreadPrivate : public XNObjectPrivate {
/**
* @brief 框架对象
*/
XNFrameworkPtr _framework;
/**
* @brief 线程运行优先级
*/
uint32_t _uPriority = 0;
/**
* @brief 线程CPU亲和性掩码
* @details 按位表示某CPU核是否使用从低到高0表示不使用1表示使用。例如0x00000003表示使用0,1号CPU
*/
uint32_t _uAffinity = 0;
/**
* @brief 线程运行频率
*/
double _setFreq = BASE_RUN_FREQ;
/**
* @brief 线程调度任务表
*/
std::vector<std::map<uint32_t, std::vector<XNCallBack> > > _funVec;
/**
* @brief pthread线程调度参数
*/
sched_param param;
/**
* @brief pthread线程属性
*/
pthread_attr_t attr;
/**
* @brief pthread线程
*/
pthread_t thread;
/**
* @brief 线程睡眠时间控制
*/
PERIOD_INFO pinfo;
/**
* @brief 线程控制锁
*/
pthread_mutex_t _mtx = PTHREAD_MUTEX_INITIALIZER;
/**
* @brief 线程控制条件变量
*/
pthread_cond_t _cond = PTHREAD_COND_INITIALIZER;
/**
* @brief 线程运行状态
*/
RunStatus _eRunStatus = RunStatus::NotStart;
/**
* @brief 线程执行进度
*/
uint32_t _RunPosition = 0;
/**
* @brief 线程执行计数
*/
int count = 0;
/**
* @brief 线程执行时间统计
*/
timespec _lastRunTime;
/**
* @brief 线程运行状态主题写入器
*/
FAST_DDS_MACRO::DataWriter *writer;
/**
* @brief 线程ID
*/
uint32_t _threadID = 0;
};