mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 20:20:52 +00:00
An optimization of the RT Lock Holder
Do not change current thread state in case we are able to immediately acquire the lock. Issue: #I9EQL0 Signed-off-by: Konstantin Grebenschikov <grebenschikov.konstantin@huawei.com> Change-Id: I5bb4c825a445013931e49bbd6e7a02e29e80b16d
This commit is contained in:
parent
bcf11cf5a4
commit
1ce54bb4aa
@ -21,6 +21,9 @@ namespace panda::ecmascript {
|
||||
RuntimeLockHolder::RuntimeLockHolder(JSThread *thread, Mutex &mtx)
|
||||
: thread_(thread), mtx_(mtx)
|
||||
{
|
||||
if (mtx_.TryLock()) {
|
||||
return;
|
||||
}
|
||||
ThreadStateTransitionScope ts(thread_, ThreadState::WAIT);
|
||||
mtx.Lock();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user