From e4877b7fa4cbd0d2bf281353cb47e4b85fa4ee21 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 13 Dec 2022 16:12:57 +0800 Subject: [PATCH] 1 --- a8/ioloop.cc | 3 +-- a8/xtimer.cc | 27 +++++++++++++++++---------- a8/xtimer.h | 11 ++++------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/a8/ioloop.cc b/a8/ioloop.cc index c49a00e..b6aac91 100644 --- a/a8/ioloop.cc +++ b/a8/ioloop.cc @@ -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(); diff --git a/a8/xtimer.cc b/a8/xtimer.cc index ad64f97..ae95b63 100644 --- a/a8/xtimer.cc +++ b/a8/xtimer.cc @@ -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 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 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) diff --git a/a8/xtimer.h b/a8/xtimer.h index 6c8c10a..0958fd8 100644 --- a/a8/xtimer.h +++ b/a8/xtimer.h @@ -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 TimerCbProc; + typedef std::function 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 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 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& timer_ptr); //删除当前运行中定时器 - void DeleteRunningTimer(); + void DeleteCurrentTimer(); + bool IsRunningTimer(); protected: //销毁定时器