!1235 修改IPC线程与回调注册线程为同一线程,posttask导致条件变量超时

Merge pull request !1235 from mashaoyin/master
This commit is contained in:
openharmony_ci 2024-06-11 07:13:59 +00:00 committed by Gitee
commit 1441e2a826
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 12 additions and 7 deletions

View File

@ -840,14 +840,19 @@ void JsInputMethodEngineSetting::FreeWorkIfFail(int ret, uv_work_t *work)
IMSA_HILOGE("uv_queue_work failed retCode:%{public}d", ret);
}
void JsInputMethodEngineSetting::PostTaskToEventHandler(std::function<void()> task, const std::string &taskName)
bool JsInputMethodEngineSetting::PostTaskToEventHandler(std::function<void()> task, const std::string &taskName)
{
auto eventHandler = GetEventHandler();
if (eventHandler == nullptr) {
IMSA_HILOGE("eventHandler is nullptr!");
return;
return false;
}
if (eventHandler == AppExecFwk::EventHandler::Current()) {
IMSA_HILOGE("in current thread!");
return false;
}
handler_->PostTask(task, taskName);
return true;
}
} // namespace MiscServices
} // namespace OHOS

View File

@ -56,7 +56,7 @@ public:
void OnSetSubtype(const SubProperty &property) override;
void OnSecurityChange(int32_t security) override;
void ReceivePrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand) override;
void PostTaskToEventHandler(std::function<void()> task, const std::string &taskName) override;
bool PostTaskToEventHandler(std::function<void()> task, const std::string &taskName) override;
private:
struct PanelContext : public AsyncCall::Context {

View File

@ -256,11 +256,10 @@ int32_t InputMethodAbility::StartInput(const InputClientInfo &clientInfo, bool i
startInputProcessHandler->SetValue(isCallbackFinished);
};
isPendingShowKeyboard_ = clientInfo.isShowKeyboard;
if (imeListener_ != nullptr) {
imeListener_->PostTaskToEventHandler(task, "startInput");
if (imeListener_ != nullptr && imeListener_->PostTaskToEventHandler(task, "startInput")) {
startInputProcessHandler->GetValue();
} else {
IMSA_HILOGE("imeListener_ is nullptr.");
IMSA_HILOGE("imeListener_ is nullptr, or post task failed!");
}
return clientInfo.isShowKeyboard ? ShowKeyboard() : ErrorCode::NO_ERROR;
}

View File

@ -38,8 +38,9 @@ public:
{
return false;
}
virtual void PostTaskToEventHandler(std::function<void()> task, const std::string &taskName)
virtual bool PostTaskToEventHandler(std::function<void()> task, const std::string &taskName)
{
return true;
}
};
} // namespace MiscServices