mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-04 08:08:16 +02:00
Updated AndroidX libraries
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package androidx.lifecycle;
|
||||
|
||||
import android.os.SystemClock;
|
||||
|
||||
import androidx.annotation.MainThread;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RestrictTo;
|
||||
@@ -91,22 +89,14 @@ public abstract class ComputableLiveData<T> {
|
||||
@Override
|
||||
public void run() {
|
||||
boolean computed;
|
||||
long age;
|
||||
do {
|
||||
computed = false;
|
||||
// compute can happen only in 1 thread but no reason to lock others.
|
||||
if (mComputing.compareAndSet(false, true)) {
|
||||
// as long as it is invalid, keep computing.
|
||||
try {
|
||||
age = SystemClock.elapsedRealtime();
|
||||
T value = null;
|
||||
while (mInvalid.compareAndSet(true, false)) {
|
||||
long now = SystemClock.elapsedRealtime();
|
||||
if (age + 1500 < now && value != null) {
|
||||
eu.faircode.email.Log.i(mLiveData + " post age=" + (now - age));
|
||||
age = now;
|
||||
mLiveData.postValue(value);
|
||||
}
|
||||
computed = true;
|
||||
value = compute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user