mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35:33 -04:00
universal7885: parts-aidl: Unlock mutex if try_lock() returned true
try_lock() returns instantly, but it does acquires mutex lock if it is avaliable. If we just return try_lock() result, mutex is still locked by the thread. So it results in forever false with try_lock(). If the try_lock() returns true, unlock and return true for fix
This commit is contained in:
parent
e9913cc821
commit
72f2eb6800
1 changed files with 6 additions and 1 deletions
|
|
@ -92,7 +92,12 @@ static void swapoff_func(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
::ndk::ScopedAStatus SwapOnData::isMutexLocked(bool *_aidl_return) {
|
::ndk::ScopedAStatus SwapOnData::isMutexLocked(bool *_aidl_return) {
|
||||||
*_aidl_return = !thread_lock.try_lock();
|
if (thread_lock.try_lock()) {
|
||||||
|
thread_lock.unlock();
|
||||||
|
*_aidl_return = false;
|
||||||
|
} else {
|
||||||
|
*_aidl_return = true;
|
||||||
|
}
|
||||||
return ::ndk::ScopedAStatus::ok();
|
return ::ndk::ScopedAStatus::ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue