Untitled

mail@pastecode.io avatar
unknown
java
22 days ago
244 B
2
Indexable
Never
class MyLock implements Lock {
    AtomicInteger state = 0;

    @Override
    public void lock() {
        while (state.getAndSet(1) == 0) {
            
        }
    }

    @Override
    public void unlock() {
        state.set(0);
    }


}
Leave a Comment