13#ifndef __xwos_cxx_DThd_hxx__
14#define __xwos_cxx_DThd_hxx__
56 bool privileged =
true);
static xwer_t sThdMainFunction(DThd *thd)
xwer_t intr()
中断线程的阻塞态和睡眠态
xwer_t sleepTo(xwtm_t to)
当前线程睡眠到一个时间点
xwer_t freeze(void)
冻结当前线程
xwer_t detach()
终止线程并等待它退出
xwer_t stop(xwer_t *trc)
通知线程退出,等待线程结束并获取它的返回值
xwer_t sleepFrom(xwtm_t *from, xwtm_t dur)
当前线程从一个时间起点睡眠到另一个时间点
xwer_t join(xwer_t *trc)
等待线程结束并获取它的返回值
struct xwos_thd * getXwosObj()
获取XWOS对象指针
bool shouldFreeze()
判断当前线程是否可被冻结
DThd(const char *name, xwsz_t stack_size, xwsz_t stack_guard_size=XWOS_STACK_GUARD_SIZE_DEFAULT, xwpr_t priority=XWOS_SKD_PRIORITY_RT_MIN, bool detached=false, bool privileged=true)
动态线程构造函数
xwer_t getStackInfo(struct xwos_thd_stack_info *stack)
获取当前线程的栈信息
bool shouldStop()
判断当前线程是否可以退出
void yield()
当前线程通知调度器重新调度
void exit(xwer_t rc)
退出当前线程
virtual xwer_t thdMainFunction()
线程主函数,用户需要重新实现此函数
xwer_t sleep(xwtm_t dur)
当前线程睡眠一段时间
xws64_t xwtm_t
XWOS系统时间 (有符号)
#define XWOS_SKD_PRIORITY_RT_MIN
XWOS API:最小实时优先级
static xwer_t xwos_cthd_sleep_to(xwtm_t to)
XWOS API:线程睡眠到一个时间点
static xwer_t xwos_thd_release(xwos_thd_d thdd)
XWOS API:检查对象的标签并减少引用计数
static xwer_t xwos_thd_stop(xwos_thd_d thdd, xwer_t *trc)
XWOS API:终止线程并等待它退出,回收线程内存资源,并抛出线程的返回值
static bool xwos_cthd_shld_stop(void)
XWOS API:判断当前线程是否可以退出
static xwer_t xwos_thd_intr(xwos_thd_d thdd)
XWOS API:中断线程的阻塞态和睡眠态
static xwer_t xwos_cthd_sleep_from(xwtm_t *from, xwtm_t dur)
XWOS API:线程从一个时间起点睡眠到另一个时间点
static xwer_t xwos_thd_acquire(xwos_thd_d thdd)
XWOS API:检查线程对象的标签并增加引用计数
#define XWOS_STACK_GUARD_SIZE_DEFAULT
XWOS API:默认的栈警戒线
static xwer_t xwos_cthd_freeze(void)
XWOS API:冻结当前线程
static xwer_t xwos_thd_get_stack_info(xwos_thd_d thdd, struct xwos_thd_stack_info *stack)
XWOS API:获取线程的栈信息
static bool xwos_cthd_shld_frz(void)
XWOS API:判断当前线程是否可被冻结
static xwer_t xwos_thd_detach(xwos_thd_d thdd)
XWMP API:分离线程
static xwer_t xwos_thd_quit(xwos_thd_d thdd)
XWOS API:通知线程退出
static void xwos_cthd_yield(void)
XWOS API:当前线程通知调度器重新调度
static void xwos_cthd_exit(xwer_t rc)
XWOS API:退出当前线程
static xwer_t xwos_cthd_sleep(xwtm_t dur)
XWOS API:当前线程睡眠一段时间
static xwer_t xwos_thd_join(xwos_thd_d thdd, xwer_t *trc)
XWOS API:等待线程结束,回收线程内存资源,抛出它的返回值