XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
SMtx.hxx
浏览该文件的文档.
1
13#ifndef __xwos_cxx_lock_SMtx_hxx__
14#define __xwos_cxx_lock_SMtx_hxx__
15
18
19namespace xwos {
20namespace lock {
21
73class SMtx
74{
75 public:
88 };
89
93 class Grd
94 {
95 private:
99
100 public:
101 Grd() = delete;
102
139 Grd(SMtx * mtx, enum LockMode mode = LockMode::SMtxLock, xwtm_t to = XWTM_MAX);
140
152
156 ~Grd();
157
170 xwer_t getRc() { return mRc; }
171
175 enum LockMode getLockMode() { return mLockMode; }
176
202 xwer_t wait(sync::Cond * cond);
203
213 xwer_t wait(sync::Cond & cond) { return wait(&cond); }
214
247 xwer_t wait(sync::Cond * cond, xwtm_t to);
248
259 xwer_t wait(sync::Cond & cond, xwtm_t to) { return wait(&cond, to); }
260 };
261
262 private:
266 public:
271 explicit SMtx(xwpr_t pr = XWOS_SKD_PRIORITY_RT_MAX);
272 ~SMtx();
273 xwer_t getCtorRc() { return mCtorRc; }
274 struct xwos_mtx * getXwosObj() { return &mLock; }
276 /* 生命周期管理 */
278 xwer_t put() { return xwos_mtx_put(&mLock); }
280 private:
281 static void * operator new(xwsz_t sz) = delete;
282 void operator delete(void * obj) = delete;
283};
284
289} // namespace lock
290} // namespace xwos
291
292#endif /* xwos/cxx/lock/SMtx.hxx */
xwos::sync::Cond
静态互斥锁的RAII机制守卫
Definition SMtx.hxx:94
Grd(SMtx &mtx, enum LockMode mode=LockMode::SMtxLock, xwtm_t to=XWTM_MAX)
构造静态互斥锁的RAII机制守卫并上锁互斥锁
xwer_t wait(sync::Cond &cond, xwtm_t to)
限时等待条件量
Definition SMtx.hxx:259
xwer_t getRc()
获取上锁结果错误码
Definition SMtx.hxx:170
xwer_t wait(sync::Cond *cond)
等待条件量
Definition SMtx.cxx:57
~Grd()
析构静态互斥锁的RAII机制守卫并解锁互斥锁
Definition SMtx.cxx:48
enum LockMode getLockMode()
获取上锁模式
Definition SMtx.hxx:175
xwer_t wait(sync::Cond &cond)
等待条件量
Definition SMtx.hxx:213
enum LockMode mLockMode
Definition SMtx.hxx:98
静态互斥锁
Definition SMtx.hxx:74
xwer_t mCtorRc
Definition SMtx.hxx:264
struct xwos_mtx mLock
Definition SMtx.hxx:263
xwer_t getCtorRc()
Definition SMtx.hxx:273
xwer_t put()
Definition SMtx.hxx:278
xwer_t grab()
Definition SMtx.hxx:277
LockMode
静态互斥锁的锁模式
Definition SMtx.hxx:79
@ SMtxLockUninterruptable
Definition SMtx.hxx:84
struct xwos_mtx * getXwosObj()
Definition SMtx.hxx:274
条件量基类
Definition Cond.hxx:31
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
#define XWTM_MAX
xwtm_t 的最大值
Definition type.h:755
signed long xwer_t
Definition type.h:554
xws32_t xwpr_t
Definition type.h:534
unsigned long xwsz_t
Definition type.h:339
uint32_t xwu32_t
Definition type.h:266
static xwer_t xwos_mtx_grab(struct xwos_mtx *mtx)
XWOS API:增加互斥锁对象的引用计数
Definition mtx.h:145
static xwer_t xwos_mtx_put(struct xwos_mtx *mtx)
XWOS API:减少互斥锁对象的引用计数
Definition mtx.h:164
#define XWOS_SKD_PRIORITY_RT_MAX
XWOS API:最大实时优先级
Definition skd.h:94
C++操作系统抽象层:互斥锁
Definition Cpu.hxx:19
XWOS API:互斥锁
Definition mtx.h:82