That fuck shit the fascists are using
at master 25 lines 566 B view raw
1package org.tm.archive.crypto; 2 3import org.whispersystems.signalservice.api.SignalSessionLock; 4 5import java.util.concurrent.locks.ReentrantLock; 6 7/** 8 * An implementation of {@link SignalSessionLock} that is backed by a {@link ReentrantLock}. 9 */ 10public enum ReentrantSessionLock implements SignalSessionLock { 11 12 INSTANCE; 13 14 private static final ReentrantLock LOCK = new ReentrantLock(); 15 16 @Override 17 public Lock acquire() { 18 LOCK.lock(); 19 return LOCK::unlock; 20 } 21 22 public boolean isHeldByCurrentThread() { 23 return LOCK.isHeldByCurrentThread(); 24 } 25}