XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
DThd.hxx
浏览该文件的文档.
1
13#ifndef __xwos_cxx_DThd_hxx__
14#define __xwos_cxx_DThd_hxx__
15
16#include <xwos/osal/thd.hxx>
17
18namespace xwos {
19
37class DThd
38{
39 private:
43 public:
53 DThd(const char * name, xwsz_t stack_size,
54 xwsz_t stack_guard_size = XWOS_STACK_GUARD_SIZE_DEFAULT,
55 xwpr_t priority = XWOS_SKD_PRIORITY_RT_MIN, bool detached = false,
56 bool privileged = true);
57 ~DThd();
58 xwer_t getCtorRc() { return mCtorRc; }
61 xwer_t join(xwer_t * trc) { return xwos_thd_join(mThdDesc, trc); }
62 xwer_t stop(xwer_t * trc) { return xwos_thd_stop(mThdDesc, trc); }
64 struct xwos_thd * getXwosObj() { return mThdDesc.thd; }
66 /* 生命周期管理 */
70 protected:
71 virtual xwer_t thdMainFunction();
72 /* 只能在当前线程函数中调用的API */
73 void yield() { xwos_cthd_yield(); }
74 void exit(xwer_t rc) { xwos_cthd_exit(rc); }
75 bool shouldFreeze() { return xwos_cthd_shld_frz(); }
76 bool shouldStop() { return xwos_cthd_shld_stop(); }
77 xwer_t sleep(xwtm_t dur) { return xwos_cthd_sleep(dur); }
79 xwer_t sleepFrom(xwtm_t * from, xwtm_t dur) { return xwos_cthd_sleep_from(from, dur); }
80 xwer_t freeze(void) { return xwos_cthd_shld_stop(); }
82 private:
83 static xwer_t sThdMainFunction(DThd * thd);
84};
85
90} // namespace xwos
91
92#endif /* xwos/cxx/DThd.hxx */
动态线程
Definition DThd.hxx:38
xwer_t mCtorRc
Definition DThd.hxx:41
xwer_t intr()
Definition DThd.hxx:59
xwer_t sleepTo(xwtm_t to)
Definition DThd.hxx:78
xwer_t freeze(void)
Definition DThd.hxx:80
xwer_t detach()
Definition DThd.hxx:63
xwer_t quit()
Definition DThd.hxx:60
xwos_thd_d mThdDesc
Definition DThd.hxx:40
static xwer_t sThdMainFunction(DThd *thd)
Definition DThd.cxx:45
xwer_t stop(xwer_t *trc)
Definition DThd.hxx:62
xwer_t acquire()
Definition DThd.hxx:67
virtual xwer_t thdMainFunction()
Definition DThd.cxx:39
xwer_t sleepFrom(xwtm_t *from, xwtm_t dur)
Definition DThd.hxx:79
xwer_t join(xwer_t *trc)
Definition DThd.hxx:61
struct xwos_thd * getXwosObj()
Definition DThd.hxx:64
xwer_t getCtorRc()
Definition DThd.hxx:58
bool shouldFreeze()
Definition DThd.hxx:75
bool shouldStop()
Definition DThd.hxx:76
void yield()
Definition DThd.hxx:73
void exit(xwer_t rc)
Definition DThd.hxx:74
xwer_t release()
Definition DThd.hxx:68
xwer_t sleep(xwtm_t dur)
Definition DThd.hxx:77
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
signed long xwer_t
Definition type.h:554
xws32_t xwpr_t
Definition type.h:534
unsigned long xwsz_t
Definition type.h:339
#define XWOS_SKD_PRIORITY_RT_MIN
XWOS API:最小实时优先级
Definition skd.h:89
static xwer_t xwos_cthd_sleep_to(xwtm_t to)
XWOS API:线程睡眠到一个时间点
Definition thd.h:716
static xwer_t xwos_thd_release(xwos_thd_d thdd)
XWOS API:检查对象的标签并减少引用计数
Definition thd.h:368
static xwer_t xwos_thd_stop(xwos_thd_d thdd, xwer_t *trc)
XWOS API:终止线程并等待它退出,回收线程内存资源,并抛出线程的返回值
Definition thd.h:495
static bool xwos_cthd_shld_stop(void)
XWOS API:判断当前线程是否可以退出
Definition thd.h:633
static xwer_t xwos_thd_intr(xwos_thd_d thdd)
XWOS API:中断线程的阻塞态和睡眠态
Definition thd.h:406
static xwer_t xwos_cthd_sleep_from(xwtm_t *from, xwtm_t dur)
XWOS API:线程从一个时间起点睡眠到另一个时间点
Definition thd.h:745
static xwer_t xwos_thd_acquire(xwos_thd_d thdd)
XWOS API:检查线程对象的标签并增加引用计数
Definition thd.h:352
#define XWOS_STACK_GUARD_SIZE_DEFAULT
XWOS API:默认的栈警戒线
Definition thd.h:190
static bool xwos_cthd_shld_frz(void)
XWOS API:判断当前线程是否可被冻结
Definition thd.h:607
static xwer_t xwos_thd_detach(xwos_thd_d thdd)
XWMP API:分离线程
Definition thd.h:517
static xwer_t xwos_thd_quit(xwos_thd_d thdd)
XWOS API:通知线程退出
Definition thd.h:437
static void xwos_cthd_yield(void)
XWOS API:当前线程通知调度器重新调度
Definition thd.h:578
static void xwos_cthd_exit(xwer_t rc)
XWOS API:退出当前线程
Definition thd.h:593
static xwer_t xwos_cthd_sleep(xwtm_t dur)
XWOS API:线程睡眠一段时间
Definition thd.h:693
static xwer_t xwos_thd_join(xwos_thd_d thdd, xwer_t *trc)
XWOS API:等待线程结束,回收线程内存资源,抛出它的返回值
Definition thd.h:472
Definition Cpu.hxx:19
XWOS API:线程对象描述符
Definition thd.h:149
struct xwos_thd * thd
Definition thd.h:150
XWOS API:线程对象
Definition thd.h:137
C++操作系统抽象层:线程