OMProtected 类

OMProtected 是受保护对象的基类。这个类中包含一个互斥对象以及自动嵌入在为该对象定义的具体公共方法中的 lockunlock 方法。

这个类是在文件 omprotected.h 中声明的。

构造概要
OMProtected
构造 OMProtected 对象
~OMProtected
销毁 OMProtected 对象
宏摘要
OMProtected 对象聚集到被守护类中,而不是让这些类继承 OMProtected
方法概要
deleteMutex
删除互斥对象并将其值设置为 NULL。
free
提供此方法是为了实现向后兼容性。此方法将调用 unlock 方法。
getGuard
获取守护对象。
initializeMutex
在尚未创建 RTOS 互斥对象时创建此互斥对象。
lock
锁定 OMProtected 对象的互斥对象。
unlock
OMProtected 对象的互斥对象解锁。

OMDECLARE_GUARDED

OMProtected 对象聚集到被守护类中,而不是让这些类继承 OMProtected。其定义如下所示:

#define OMDECLARE_GUARDED

public:
inline void lock() const {m_omGuard.lock();}
inline void unlock() const {m_omGuard.unlock();}
inline const OMProtected& getGuard() const
{return m_omGuard;}
private:
OmProtected m_omGuard;


反馈