Don't change lock's status if there are lock requests in the heldList_.

Issue: https://gitee.com/openharmony/commonlibrary_ets_utils/issues/IASLEL

Change-Id: I3ad4061d000db4452936b7176a3b9b159e175df2
Signed-off-by: Artem Udovichenko <artem.udovichenko@huawei.com>
This commit is contained in:
Artem Udovichenko 2024-09-20 14:02:22 +03:00 committed by diartyz
parent d5f601165a
commit b3f8719a33

View File

@ -65,7 +65,11 @@ void AsyncLock::CleanUpLockRequestOnCompletion(LockRequest* lockRequest)
return;
}
heldList_.erase(it);
lockStatus_ = LOCK_MODE_UNLOCK;
if (heldList_.empty()) {
// There are may be other shared lock requests in the heldList_.
// IF so, we mustn't change the status.
lockStatus_ = LOCK_MODE_UNLOCK;
}
napi_env env = lockRequest->GetEnv();
delete lockRequest;
ProcessPendingLockRequest(env);