diff --git a/f8/dbpool.cc b/f8/dbpool.cc index d6f7864..0c0a105 100644 --- a/f8/dbpool.cc +++ b/f8/dbpool.cc @@ -12,7 +12,6 @@ #include #include -#include #include #include #include @@ -20,6 +19,7 @@ #include #include #include +#include namespace f8 { @@ -46,7 +46,7 @@ namespace f8 time_t add_time = 0; AsyncDBOnOkFunc on_ok = nullptr; AsyncDBOnErrorFunc on_error = nullptr; - a8::TimerAttacher timer_attacher; + f8::Attacher timer_attacher; }; struct AsyncQueryNode @@ -449,24 +449,24 @@ namespace f8 conn_info.DeepCopy(node->conn_info); db_thread->AddAsyncQuery(node); } - a8::Timer::Instance()->AddDeadLineTimerAndAttach + int msgid = exec_async_query_msgid; + f8::Timer::Instance()->SetTimeoutEx (1000 * 10, - a8::XParams() - .SetSender(p->context_id) - .SetParam1(exec_async_query_msgid), - [] (const a8::XParams& param) + [p, msgid] (int event, const a8::Args* args) { - MsgQueue::Instance()->PostMsg - (param.param1.GetInt(), - a8::Args - ( - { - param.sender.GetInt(), - AQE_CONN_ERROR - } - )); + if (event == a8::TIMER_EXEC_EVENT) { + MsgQueue::Instance()->PostMsg + (msgid, + a8::Args + ( + { + p->context_id, + AQE_CONN_ERROR + } + )); + } }, - &p->timer_attacher.timer_list_); + &p->timer_attacher); ++DBPool::Instance()->total_query_num; } diff --git a/f8/httpclientpool.cc b/f8/httpclientpool.cc index 9e59752..4c21a8d 100644 --- a/f8/httpclientpool.cc +++ b/f8/httpclientpool.cc @@ -15,7 +15,6 @@ #include #include -#include #include #include #include @@ -24,6 +23,7 @@ #include #include #include +#include #define F8_MUTLI_THREAD_HTTP 1 @@ -43,7 +43,7 @@ namespace f8 time_t add_time = 0; AsyncHttpOnOkFunc on_ok = nullptr; AsyncHttpOnErrorFunc on_error = nullptr; - a8::TimerAttacher timer_attacher; + f8::Attacher timer_attacher; }; struct AsyncHttpNode @@ -419,15 +419,13 @@ namespace f8 http_thread->AddAsyncHttp(node); #endif } - a8::Timer::Instance()->AddDeadLineTimerAndAttach(1000 * 10, - a8::XParams() - .SetSender(this) - .SetParam1(p->context_id), - [] (const a8::XParams& param) - { + f8::Timer::Instance()->SetTimeoutEx + (1000 * 10, + [p] (int event, const a8::Args* args) + { - }, - &p->timer_attacher.timer_list_); + }, + &p->timer_attacher); } #if F8_MUTLI_THREAD_HTTP diff --git a/f8/msgqueue.cc b/f8/msgqueue.cc index d4d1a50..95340db 100644 --- a/f8/msgqueue.cc +++ b/f8/msgqueue.cc @@ -6,9 +6,9 @@ #include -#include +#include -#include "f8/msgqueue.h" +#include namespace f8 {