mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-12-04 14:12:19 +00:00
fix code
Signed-off-by: liuziwei <liuziwei12@huawei.com>
This commit is contained in:
parent
1a87d030d9
commit
2c6644fbd9
@ -53,6 +53,7 @@ private:
|
||||
void RegisterExecutorCallback(ExecutorInfo &executorInfo);
|
||||
void UnregisterExecutorCallback();
|
||||
void RespondCallbackOnDisconnect();
|
||||
bool IsExecutorRegistered();
|
||||
std::recursive_mutex registerMutex_;
|
||||
std::recursive_mutex mutex_;
|
||||
std::shared_ptr<ExecutorRegisterCallback> executorCallback_ {nullptr};
|
||||
|
@ -86,6 +86,16 @@ void Executor::OnFrameworkReady()
|
||||
RegisterExecutorCallback(executorInfo);
|
||||
}
|
||||
|
||||
bool Executor::IsExecutorRegistered()
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lockExecutorIndex(mutex_);
|
||||
if (executorIndex_.has_value()) {
|
||||
IAM_LOGI("%{public}s executor already registered", GetDescription());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Executor::RegisterExecutorCallback(ExecutorInfo &executorInfo)
|
||||
{
|
||||
IAM_LOGI("%{public}s start", GetDescription());
|
||||
@ -101,11 +111,10 @@ void Executor::RegisterExecutorCallback(ExecutorInfo &executorInfo)
|
||||
IF_FALSE_LOGE_AND_RETURN(executorCallback_ != nullptr);
|
||||
}
|
||||
executorCallback = executorCallback_;
|
||||
|
||||
if (executorIndex_.has_value()) {
|
||||
IAM_LOGI("%{public}s executor already registered, try unregister", GetDescription());
|
||||
UnregisterExecutorCallback();
|
||||
}
|
||||
}
|
||||
if (IsExecutorRegistered()) {
|
||||
IAM_LOGI("%{public}s executor already registered, try unregister", GetDescription());
|
||||
UnregisterExecutorCallback();
|
||||
}
|
||||
IF_FALSE_LOGE_AND_RETURN(executorMgrWrapper_ != nullptr);
|
||||
uint64_t executorIndex = executorMgrWrapper_->Register(executorInfo, executorCallback);
|
||||
|
Loading…
Reference in New Issue
Block a user