mirror of
https://gitee.com/openharmony/communication_ipc
synced 2024-12-02 21:28:28 +00:00
update ipc/native/src/core/source/process_skeleton.cpp.
Signed-off-by: dengyutao <dengyutao2@huawei.com>
This commit is contained in:
parent
0f2deafe25
commit
1e85c2d204
@ -160,21 +160,23 @@ sptr<IRemoteObject> ProcessSkeleton::QueryObject(const std::u16string &descripto
|
||||
ZLOGE(LOG_LABEL, "descriptor is null");
|
||||
return result;
|
||||
}
|
||||
|
||||
CHECK_INSTANCE_EXIT_WITH_RETVAL(exitFlag_, nullptr);
|
||||
std::shared_lock<std::shared_mutex> lockGuard(objMutex_, std::defer_lock);
|
||||
ZLOGD(LOG_LABEL, "The value of lockflag is:%{public}d", lockFlag);
|
||||
if (lockFlag) {
|
||||
lockGuard.lock();
|
||||
}
|
||||
IRemoteObject *remoteObject = nullptr;
|
||||
auto it = objects_.find(descriptor);
|
||||
if (it != objects_.end()) {
|
||||
// Life-time of IPCObjectProxy is extended to WEAK
|
||||
// now it's weak reference counted, so it's safe to get raw pointer
|
||||
remoteObject = it->second.GetRefPtr();
|
||||
CHECK_INSTANCE_EXIT_WITH_RETVAL(exitFlag_, nullptr);
|
||||
{
|
||||
std::shared_lock<std::shared_mutex> lockGuard(objMutex_, std::defer_lock);
|
||||
ZLOGD(LOG_LABEL, "The value of lockflag is:%{public}d", lockFlag);
|
||||
if (lockFlag) {
|
||||
lockGuard.lock();
|
||||
}
|
||||
auto it = objects_.find(descriptor);
|
||||
if (it != objects_.end()) {
|
||||
// Life-time of IPCObjectProxy is extended to WEAK
|
||||
// now it's weak reference counted, so it's safe to get raw pointer
|
||||
remoteObject = it->second.GetRefPtr();
|
||||
}
|
||||
}
|
||||
if (remoteObject == nullptr || !remoteObject->AttemptIncStrong(this)) {
|
||||
DeadObjectInfo deadInfo;
|
||||
if (remoteObject == nullptr || IsDeadObject(remoteObject, deadInfo) || !remoteObject->AttemptIncStrong(this)) {
|
||||
return result;
|
||||
}
|
||||
result = remoteObject;
|
||||
|
Loading…
Reference in New Issue
Block a user