mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-22 20:15:32 -04:00
universal7885: parts: Use isMutexLocked() to disable switch if needed
This commit is contained in:
parent
b226436fc7
commit
c12209095a
4 changed files with 9 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ void SmartChargeImpl::start(void) {
|
|||
shouldRun = true;
|
||||
monitor = new std::thread(battery_monitor, limit_percent, restart_percent,
|
||||
&charge_limit_cnt, &restart_cnt);
|
||||
monitor->join();
|
||||
monitor->detach();
|
||||
}
|
||||
|
||||
void SmartChargeImpl::stop(void) {
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ static void swapon_func(void) {
|
|||
}
|
||||
|
||||
static void swapoff_func(void) {
|
||||
if (!swapfile_exist()) return;
|
||||
const std::lock_guard<std::mutex> lock(thread_lock);
|
||||
swapoff(SWAP_PATH);
|
||||
}
|
||||
|
||||
::ndk::ScopedAStatus SwapOnData::setSwapOff() {
|
||||
if (!swapfile_exist()) return ::ndk::ScopedAStatus::ok();
|
||||
std::thread swapoff_thread(swapoff_func);
|
||||
swapoff_thread.detach();
|
||||
return ::ndk::ScopedAStatus::ok();
|
||||
|
|
|
|||
Loading…
Reference in a new issue