File tree Expand file tree Collapse file tree
core/src/main/java/org/bitcoinj Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131import java .lang .management .ThreadMXBean ;
3232import java .util .concurrent .*;
3333import java .util .concurrent .locks .ReentrantLock ;
34+ import java .util .concurrent .locks .ReentrantReadWriteLock ;
3435
3536/**
3637 * Various threading related utilities. Provides a wrapper around explicit lock creation that lets you control whether
@@ -192,6 +193,13 @@ public static CycleDetectingLockFactory.Policy getPolicy() {
192193 return policy ;
193194 }
194195
196+ public static ReentrantReadWriteLock readWriteLock (String name ) {
197+ if (Utils .isAndroidRuntime () && useDefaultAndroidPolicy )
198+ return new ReentrantReadWriteLock (true );
199+ else
200+ return factory .newReentrantReadWriteLock (name );
201+ }
202+
195203 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
196204 //
197205 // Generic worker pool.
You can’t perform that action at this time.
0 commit comments