Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/src/main/java/org/bitcoinj/utils/Threading.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.lang.management.ThreadMXBean;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
* Various threading related utilities. Provides a wrapper around explicit lock creation that lets you control whether
Expand Down Expand Up @@ -192,6 +193,13 @@ public static CycleDetectingLockFactory.Policy getPolicy() {
return policy;
}

public static ReentrantReadWriteLock readWriteLock(String name) {
if (Utils.isAndroidRuntime() && useDefaultAndroidPolicy)
return new ReentrantReadWriteLock(true);
else
return factory.newReentrantReadWriteLock(name);
}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Generic worker pool.
Expand Down
Loading