From f957c177480904e1f3b057d715883c73583f398e Mon Sep 17 00:00:00 2001 From: li_junsong Date: Thu, 26 Dec 2024 16:40:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0fd=E7=BB=B4=E6=B5=8B=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=EF=BC=8C=E9=81=BF=E5=85=8DECANCEL=E8=87=B4=E4=BD=BF?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E5=88=9B=E5=BB=BA=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li_junsong --- services/timer/src/timer_handler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/timer/src/timer_handler.cpp b/services/timer/src/timer_handler.cpp index e073b577..9b31bc9c 100644 --- a/services/timer/src/timer_handler.cpp +++ b/services/timer/src/timer_handler.cpp @@ -49,6 +49,8 @@ std::shared_ptr TimerHandler::Create() return nullptr; } + std::string fdStr = ""; + std::string typStr = ""; for (size_t i = 0; i < fds.size(); i++) { fds[i] = timerfd_create(alarm_to_clock_id[i], 0); if (fds[i] < 0) { @@ -60,7 +62,10 @@ std::shared_ptr TimerHandler::Create() } return nullptr; } + fdStr += std::to_string(fds[i]) + " "; + typStr += std::to_string(i) + " "; } + TIME_HILOGW(TIME_MODULE_SERVICE, "create fd:[%{public}s], typ:[%{public}s]", fdStr.c_str(), typStr.c_str()); std::shared_ptr handler = std::shared_ptr(new TimerHandler(fds, epollfd)); for (size_t i = 0; i < fds.size(); i++) { @@ -77,8 +82,9 @@ std::shared_ptr TimerHandler::Create() itimerspec spec {}; int err = timerfd_settime(fds[ALARM_TYPE_COUNT], TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET, &spec, nullptr); - if (err < 0) { - TIME_HILOGE(TIME_MODULE_SERVICE, "timerfd_settime() failed: %{public}s", strerror(errno)); + TIME_HILOGW(TIME_MODULE_SERVICE, "settime fd: %{public}d, res: %{public}d, errno: %{public}s", + fds[ALARM_TYPE_COUNT], err, strerror(errno)); + if (err < 0 && errno != ECANCELED) { return nullptr; } -- Gitee