mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-13 02:35:52 +00:00
On Android, use non-cycle detecting locks with fairness activated (experimental)
This commit is contained in:
parent
59b426afe0
commit
7f14f7e491
@ -20,6 +20,7 @@ import com.google.common.util.concurrent.CycleDetectingLockFactory;
|
||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||
import com.google.common.util.concurrent.MoreExecutors;
|
||||
import com.google.common.util.concurrent.Uninterruptibles;
|
||||
import org.bitcoinj.core.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -152,7 +153,10 @@ public class Threading {
|
||||
public static CycleDetectingLockFactory factory;
|
||||
|
||||
public static ReentrantLock lock(String name) {
|
||||
return factory.newReentrantLock(name);
|
||||
if (Utils.isAndroidRuntime())
|
||||
return new ReentrantLock(true);
|
||||
else
|
||||
return factory.newReentrantLock(name);
|
||||
}
|
||||
|
||||
public static void warnOnLockCycles() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user