This commit is contained in:
aozhiwei 2022-12-13 16:12:57 +08:00
parent e4a9fab0ef
commit e4877b7fa4
3 changed files with 22 additions and 19 deletions

View File

@ -268,8 +268,7 @@ namespace a8
context->xtimer.AddDeadLineTimer
(
param.param1,
a8::Args({}),
[client] (int event, const a8::Args& args, const a8::Args* user_args)
[client] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
client->DoAsyncClose();

View File

@ -42,7 +42,6 @@ struct xtimer_list {
struct xtvec_base *base;
a8::TimerCbProc cb;
a8::Args args;
};
struct XTimerDestoryHandleNode
@ -104,7 +103,7 @@ static inline int DetachTimer(struct xtimer_list *timer)
static inline void InitTimerList(xtvec_base* base, xtimer_list* timer, int timer_type,
long long expires, int expire_time,
a8::Args args, a8::TimerCbProc cb)
a8::TimerCbProc cb)
{
INIT_LIST_HEAD(&timer->destory_handle_list);
INIT_LIST_HEAD(&timer->entry);
@ -115,7 +114,6 @@ static inline void InitTimerList(xtvec_base* base, xtimer_list* timer, int timer
timer->fixed_timer_execute_times = 0;
timer->base = base;
timer->cb = std::move(cb);
timer->args = std::move(args);
}
namespace a8
@ -159,8 +157,7 @@ namespace a8
base_->timer_tick = get_tick_count_func_(context_);
AddRepeatTimer
(gc_time_,
a8::Args({}),
[this] (int event, const a8::Args& args, const a8::Args* user_args)
[this] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
int i = 0;
@ -188,7 +185,6 @@ namespace a8
void XTimer::AddDeadLineTimer(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher
)
@ -198,7 +194,6 @@ namespace a8
std::weak_ptr<XTimerPtr> XTimer::AddDeadLineTimerEx(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher
)
@ -208,7 +203,6 @@ namespace a8
void XTimer::AddRepeatTimer(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher)
{
@ -217,7 +211,6 @@ namespace a8
std::weak_ptr<XTimerPtr> XTimer::AddRepeatTimerEx(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher)
{
@ -270,11 +263,25 @@ namespace a8
}
void XTimer::DeleteRunningTimer()
void XTimer::DeleteCurrentTimer()
{
}
bool XTimer::IsRunningTimer()
{
}
void XTimer::Clear()
{
}
void XTimer::UpdateTimer()
{
}
#else
xtimer_list* XTimer::AddDeadLineTimer(int expire_time, a8::XParams param, a8::XTimerFunc timer_func,
a8::XTimerAfterFunc timer_after_func)

View File

@ -10,11 +10,11 @@ namespace a8
{
const int TIMER_EXEC_EVENT = 1;
const int TIMER_DELETE_EVNET = 2;
const int TIMER_DELETE_EVENT = 2;
const int TIMER_DESTORY_EVNET = 3;
const int TIMER_USER_EVNET = 66;
typedef std::function<void(int, const a8::Args&, const a8::Args*)> TimerCbProc;
typedef std::function<void(int, const a8::Args*)> TimerCbProc;
typedef long long (*XGetTickCountFunc)(void*);
typedef struct list_head XTimerDestoryHandle;
@ -33,14 +33,12 @@ namespace a8
//添加截止时间定时器(一次性定时器)
void AddDeadLineTimer(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher = nullptr
);
std::weak_ptr<XTimerPtr> AddDeadLineTimerEx(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher = nullptr
);
@ -48,13 +46,11 @@ namespace a8
//添加重复执行定时器(周期性定时器)
void AddRepeatTimer(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher = nullptr);
std::weak_ptr<XTimerPtr> AddRepeatTimerEx(
int expire_time,
a8::Args args,
a8::TimerCbProc timer_cb,
a8::XTimerAttacher* attacher = nullptr);
@ -68,7 +64,8 @@ namespace a8
//获取定时器剩余时间
long long GetRemainTime(std::weak_ptr<XTimerPtr>& timer_ptr);
//删除当前运行中定时器
void DeleteRunningTimer();
void DeleteCurrentTimer();
bool IsRunningTimer();
protected:
//销毁定时器