|
fastdo
0.6.16
|
条件变量 更多...
#include <threads.hpp>
Public 成员函数 | |
| Condition (bool isCreate=false) | |
| ~Condition () | |
| Condition (Condition &&other) | |
| Condition & | operator= (Condition &&other) |
| int | create () |
| 创建并初始化 更多... | |
| int | destroy () |
| 销毁 更多... | |
| bool | wait (Mutex &mutex, double sec=-1) |
| 等待被通知 更多... | |
| template<typename _Predicate > | |
| bool | waitUntil (_Predicate pred, Mutex &mutex, double sec=-1) |
| 等待谓词条件达成 更多... | |
| int | notify () |
| 通知一个正在wait()中的线程醒来 更多... | |
| int | notifyAll () |
| 通知所有正在wait()中的线程醒来 更多... | |
| ConditionAttr & | attr () |
条件变量
在文件 threads.hpp 第 414 行定义.
|
explicit |
| winux::Condition::~Condition | ( | ) |
| winux::Condition::Condition | ( | Condition && | other | ) |
| int winux::Condition::create | ( | ) |
创建并初始化
| int winux::Condition::destroy | ( | ) |
销毁
| bool winux::Condition::wait | ( | Mutex & | mutex, |
| double | sec = -1 |
||
| ) |
等待被通知
sec<1表示小于1秒的时间,sec<0表示无限等待。eg: sec=1.5表示等待1500ms 在mutex锁定之间调用,超时返回false。不满足条件请循环wait()。eg: while ( !条件 ) wait();
|
inline |
等待谓词条件达成
sec<1表示小于1秒的时间,sec<0表示无限等待。eg: sec=1.5表示等待1500ms 在mutex锁定之间调用,给定一个谓词描述条件达成,条件不达成就循环wait(),直到达成或超时,超时返回pred()。
在文件 threads.hpp 第 440 行定义.
| int winux::Condition::notify | ( | ) |
通知一个正在wait()中的线程醒来
| int winux::Condition::notifyAll | ( | ) |
通知所有正在wait()中的线程醒来
| ConditionAttr& winux::Condition::attr | ( | ) |