mirror of
https://gitee.com/openharmony/account_os_account
synced 2024-11-26 19:50:37 +00:00
创建InitTheme线程后分离
Signed-off-by: swg3156201044 <shiweigang2@huawei.com>
This commit is contained in:
parent
1abc4999c1
commit
6595b0bc61
@ -26,7 +26,7 @@ namespace OHOS {
|
||||
namespace AccountSA {
|
||||
class AccountTimeoutTask : public std::enable_shared_from_this<AccountTimeoutTask> {
|
||||
public:
|
||||
bool RunTask(std::string taskName, std::function<void()> callback, int32_t timeout = WAIT_TIME);
|
||||
bool RunTask(std::string taskName, const std::function<void()> &callback, int32_t timeout = WAIT_TIME);
|
||||
|
||||
bool isCalled_ = false;
|
||||
std::mutex mutex_;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace AccountSA {
|
||||
bool AccountTimeoutTask::RunTask(std::string taskName, std::function<void()> callback, int32_t timeout)
|
||||
bool AccountTimeoutTask::RunTask(std::string taskName, const std::function<void()> &callback, int32_t timeout)
|
||||
{
|
||||
auto task = [callback, weakPtr = weak_from_this()] {
|
||||
callback();
|
||||
|
@ -410,9 +410,15 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountCreate(
|
||||
}
|
||||
int32_t localId = osAccountInfo.GetLocalId();
|
||||
#ifdef HAS_THEME_SERVICE_PART
|
||||
auto task = [localId] { OsAccountInterface::InitThemeResource(localId); };
|
||||
auto task = [localId] {
|
||||
#ifdef HICOLLIE_ENABLE
|
||||
AccountTimer timer;
|
||||
#endif // HICOLLIE_ENABLE
|
||||
OsAccountInterface::InitThemeResource(localId);
|
||||
};
|
||||
std::thread theme_thread(task);
|
||||
pthread_setname_np(theme_thread.native_handle(), "InitTheme");
|
||||
theme_thread.detach();
|
||||
#endif
|
||||
errCode = OsAccountInterface::SendToBMSAccountCreate(osAccountInfo, options.disallowedHapList);
|
||||
if (errCode != ERR_OK) {
|
||||
@ -420,18 +426,8 @@ ErrCode IInnerOsAccountManager::SendMsgForAccountCreate(
|
||||
if (osAccountInfo.GetIsDataRemovable()) {
|
||||
(void)OsAccountInterface::SendToStorageAccountRemove(osAccountInfo);
|
||||
}
|
||||
#ifdef HAS_THEME_SERVICE_PART
|
||||
if (theme_thread.joinable()) {
|
||||
theme_thread.join();
|
||||
}
|
||||
#endif
|
||||
return errCode;
|
||||
}
|
||||
#ifdef HAS_THEME_SERVICE_PART
|
||||
if (theme_thread.joinable()) {
|
||||
theme_thread.join();
|
||||
}
|
||||
#endif
|
||||
AppAccountControlManager::GetInstance().SetOsAccountRemoved(osAccountInfo.GetLocalId(), false);
|
||||
osAccountInfo.SetIsCreateCompleted(true);
|
||||
errCode = osAccountControl_->UpdateOsAccount(osAccountInfo);
|
||||
|
Loading…
Reference in New Issue
Block a user