SyncLockWithStatusT 类
支持 WRL 基础结构,不应在代码中直接使用。
语法
template <typename SyncTraits>
class SyncLockWithStatusT : public SyncLockT<SyncTraits>;
参数
SyncTraits
该类型可以获取资源的独占或共享所有权。
注解
表示一种类型,该类型可以获取资源的独占或共享所有权。
该 SyncLockWithStatusT
类用于实现 Mutex 和 Semaphore 类。
成员
公共构造函数
名称 | 描述 |
---|---|
SyncLockWithStatusT::SyncLockWithStatusT | 初始化 SyncLockWithStatusT 类的新实例。 |
受保护构造函数
名称 | 描述 |
---|---|
SyncLockWithStatusT::SyncLockWithStatusT | 初始化 SyncLockWithStatusT 类的新实例。 |
公共方法
名称 | 描述 |
---|---|
SyncLockWithStatusT::GetStatus | 检索当前 SyncLockWithStatusT 对象的等待状态。 |
SyncLockWithStatusT::IsLocked | 指示当前 SyncLockWithStatusT 对象是否拥有资源;也就是说,对象 SyncLockWithStatusT 已锁定。 |
受保护的数据成员
名称 | 描述 |
---|---|
SyncLockWithStatusT::status_ | 对基于当前 SyncLockWithStatusT 对象的对象进行锁定操作之后,保留基础等待操作的结果。 |
继承层次结构
SyncLockT
SyncLockWithStatusT
要求
标头:corewrappers.h
命名空间:Microsoft::WRL::Wrappers::Details
SyncLockWithStatusT::GetStatus
支持 WRL 基础结构,不应在代码中直接使用。
DWORD GetStatus() const;
返回值
对基于 SyncLockWithStatusT
类(如 Mutex 或 Semaphore)的对象进行等待操作的结果。 零 (0) 指示等待操作返回信号状态;否则,发生另一个状态,例如超时值已用。
备注
检索当前 SyncLockWithStatusT
对象的等待状态。
GetStatus () 函数检索基础 status_ 数据成员的值。 当基于 SyncLockWithStatusT
类的对象执行锁定操作时,该对象首先等待对象变得可用。 结果为等待操作存储在 status_
数据成员中。 status_
数据成员的值可能是等待操作的返回值。 有关详细信息,请参阅 WaitForSingleObjectEx
函数的返回值。
SyncLockWithStatusT::IsLocked
支持 WRL 基础结构,不应在代码中直接使用。
bool IsLocked() const;
注解
指示当前 SyncLockWithStatusT
对象是否拥有资源;也就是说,对象 SyncLockWithStatusT
已锁定。
返回值
如果 SyncLockWithStatusT
对象处于锁定状态,则为 true
;否则为 false
。
SyncLockWithStatusT::status_
支持 WRL 基础结构,不应在代码中直接使用。
DWORD status_;
备注
对基于当前 SyncLockWithStatusT
对象的对象进行锁定操作之后,保留基础等待操作的结果。
SyncLockWithStatusT::SyncLockWithStatusT
支持 WRL 基础结构,不应在代码中直接使用。
SyncLockWithStatusT(
_Inout_ SyncLockWithStatusT&& other
);
explicit SyncLockWithStatusT(
typename SyncTraits::Type sync,
DWORD status
);
参数
其他
对另一个 SyncLockWithStatusT
对象的 rvalue 引用。
sync
对另一个 SyncLockWithStatusT
对象的引用。
status
other 参数或 sync 参数的 status_ 数据成员的值。
备注
初始化 SyncLockWithStatusT
类的新实例。
第一个构造函数从 other 参数指定的另一个 SyncLockWithStatusT
初始化当前 SyncLockWithStatusT
对象,然后使其他 SyncLockWithStatusT
对象失效。 第二个构造函数是 protected
,并将当前 SyncLockWithStatusT
对象初始化为无效状态。