mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-04 05:22:25 +00:00
commit
f88067fc46
@ -19,18 +19,13 @@ namespace OHOS {
|
||||
namespace AbilityRuntime {
|
||||
sptr<InsightIntentHostClient> InsightIntentHostClient::instance_ = nullptr;
|
||||
std::mutex InsightIntentHostClient::instanceMutex_;
|
||||
std::once_flag InsightIntentHostClient::singletonFlag_;
|
||||
|
||||
sptr<InsightIntentHostClient> InsightIntentHostClient::GetInstance()
|
||||
{
|
||||
if (instance_ == nullptr) {
|
||||
std::lock_guard<std::mutex> lock_l(instanceMutex_);
|
||||
if (instance_ == nullptr) {
|
||||
instance_ = new (std::nothrow) InsightIntentHostClient();
|
||||
if (instance_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::INTENT, "failed to create InsightIntentHostClient.");
|
||||
}
|
||||
}
|
||||
}
|
||||
std::call_once(singletonFlag_, []() {
|
||||
instance_ = new (std::nothrow) InsightIntentHostClient();
|
||||
});
|
||||
return instance_;
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ public:
|
||||
|
||||
private:
|
||||
static std::mutex instanceMutex_;
|
||||
static std::once_flag singletonFlag_;
|
||||
uint64_t key_ = 0;
|
||||
static sptr<InsightIntentHostClient> instance_;
|
||||
mutable std::mutex insightIntentExecutebackMutex_;
|
||||
|
Loading…
Reference in New Issue
Block a user