public static void main(String[] args) { JavaConcurrencyReentrantReadWriteLocker locker = new JavaConcurrencyReentrantReadWriteLocker(); locker.init(null); T[] readers = new T[24]; T[] writers = new T[5]; for (int i = 0; i < 12; i++) { readers[i] = locker.new T("Reader " + i, locker); readers[i].start(); } for (int i = 0; i < writers.length; i++) { writers[i] = locker.new T("Writer " + i, locker); writers[i].start(); } for (int i = 12; i < 24; i++) { readers[i] = locker.new T("Reader " + i, locker); readers[i].start(); } }
public JavaConcurrencyReentrantReadWriteLocker() { init(null); }