From 11ff8d33681d7d4ee24bf2a46e21bd7636db73e7 Mon Sep 17 00:00:00 2001 From: zhangsaiyang Date: Sat, 17 May 2025 11:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=95=B4=E6=94=B9std::bind?= =?UTF-8?q?=E6=95=B4=E6=94=B9=E4=B8=BAlambda=E8=A1=A8=E8=BE=BE=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangsaiyang --- frameworks/native/inputmethod_ability/include/tasks/task_ams.h | 2 +- frameworks/native/inputmethod_ability/src/task_manager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/native/inputmethod_ability/include/tasks/task_ams.h b/frameworks/native/inputmethod_ability/include/tasks/task_ams.h index 84244b725..8fb037d0d 100644 --- a/frameworks/native/inputmethod_ability/include/tasks/task_ams.h +++ b/frameworks/native/inputmethod_ability/include/tasks/task_ams.h @@ -31,7 +31,7 @@ public: TaskAmsInit() : Task(TASK_TYPE_AMS_INIT) { auto action = std::make_unique(seqId_, AMS_INIT_TIMEOUT_MS, - std::bind(&TaskAmsInit::OnComplete, this), std::bind(&TaskAmsInit::OnTimeout, this)); + [this]() { OnComplete(); }, [this]() { OnTimeout(); }); actions_.push_back(std::move(action)); } ~TaskAmsInit() = default; diff --git a/frameworks/native/inputmethod_ability/src/task_manager.cpp b/frameworks/native/inputmethod_ability/src/task_manager.cpp index 4bbbac50a..47328eef8 100644 --- a/frameworks/native/inputmethod_ability/src/task_manager.cpp +++ b/frameworks/native/inputmethod_ability/src/task_manager.cpp @@ -47,7 +47,7 @@ uint64_t TaskManager::PostTask(task_ptr_t task, uint32_t delayMs) return 0; } - auto func = std::bind(&TaskManager::OnNewTask, this, task); + auto func = [this, task]() { OnNewTask(task); }; eventHandler_->PostTask(func, __FUNCTION__, delayMs); return task->GetSeqId(); } -- Gitee