1#ifndef NEFORCE_CORE_SYSTEM_SYSTEM_EVENT_HPP__
2#define NEFORCE_CORE_SYSTEM_SYSTEM_EVENT_HPP__
12#ifdef NEFORCE_PLATFORM_LINUX
16NEFORCE_BEGIN_NAMESPACE__
45#ifdef NEFORCE_PLATFORM_LINUX
46 struct mutex_deleter {
47 void operator()(::pthread_mutex_t* m)
const noexcept {
48 ::pthread_mutex_destroy(m);
54 void operator()(::pthread_cond_t* d)
const noexcept {
55 ::pthread_cond_destroy(d);
61#ifdef NEFORCE_PLATFORM_WINDOWS
64 unique_ptr<::pthread_mutex_t, mutex_deleter> mutex_;
65 unique_ptr<::pthread_cond_t, cond_deleter> cond_;
129#ifdef NEFORCE_PLATFORM_WINDOWS
140NEFORCE_END_NAMESPACE__
void * native_handle() const noexcept
获取原生事件句柄
system_event(bool initial_state=false, type t=type::auto_reset)
构造函数
void reset() noexcept
重置事件为无信号状态
@ auto_reset
自动重置,只唤醒一个等待线程,之后自动重置为无信号
bool wait(uint32_t timeout_ms=numeric_traits< uint32_t >::max()) noexcept
等待事件变为有信号状态
void set() noexcept
设置事件为有信号状态
system_event & operator=(system_event &&other) noexcept
移动赋值运算符
system_event(system_event &&other) noexcept
移动构造函数
type event_type() const noexcept
获取事件类型
constexpr const T & max(const T &a, const T &b, Compare comp) noexcept(noexcept(comp(a, b)))
返回两个值中的较大者
unsigned int uint32_t
32位无符号整数类型