2019-07-28 10:31:56 +08:00
|
|
|
|
#pragma once
|
2018-11-30 14:38:22 +08:00
|
|
|
|
#include "fiber_cpp_define.hpp"
|
|
|
|
|
|
2018-12-01 12:04:36 +08:00
|
|
|
|
struct ACL_FIBER_COND;
|
2018-11-30 14:38:22 +08:00
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
2022-11-13 23:37:41 +08:00
|
|
|
|
class fiber_mutex;
|
2018-11-30 14:38:22 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>֮<EFBFBD>䣬<EFBFBD>߳<EFBFBD>֮<EFBFBD>䣬Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2018-11-30 14:38:22 +08:00
|
|
|
|
*/
|
2020-06-24 16:46:05 +08:00
|
|
|
|
class FIBER_CPP_API fiber_cond
|
2018-11-30 14:38:22 +08:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
fiber_cond(void);
|
|
|
|
|
~fiber_cond(void);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2022-11-13 23:37:41 +08:00
|
|
|
|
* @param mutex {fiber_mutex&}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱ<EFBFBD>ȴ<EFBFBD>ʱ<EFBFBD>䣨<EFBFBD><EFBFBD><EFBFBD>룩
|
|
|
|
|
* @return {bool} <EFBFBD>ɹ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> true<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>ʱ
|
2018-11-30 14:38:22 +08:00
|
|
|
|
*/
|
2022-11-13 23:37:41 +08:00
|
|
|
|
bool wait(fiber_mutex& mutex, int timeout = -1);
|
2018-11-30 14:38:22 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵĵȴ<EFBFBD><EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>еȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>߳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {bool} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> false <EFBFBD><EFBFBD>ʾʧ<EFBFBD><EFBFBD>
|
2018-11-30 14:38:22 +08:00
|
|
|
|
*/
|
|
|
|
|
bool notify(void);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> C <EFBFBD>汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2018-11-30 14:38:22 +08:00
|
|
|
|
* @return {ACL_FIBER_COND*}
|
|
|
|
|
*/
|
|
|
|
|
ACL_FIBER_COND* get_cond(void) const
|
|
|
|
|
{
|
|
|
|
|
return cond_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
ACL_FIBER_COND* cond_;
|
2020-06-24 16:46:05 +08:00
|
|
|
|
|
|
|
|
|
fiber_cond(const fiber_cond&);
|
|
|
|
|
void operator=(const fiber_cond&);
|
2018-11-30 14:38:22 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|