@@ -0,0 +1,1533 @@
+package com.github.mottox.taomp.concurrent.locks;%0A%0Aimport java.util.concurrent.locks.Condition;%0Aimport java.util.concurrent.locks.Lock;%0Aimport java.util.concurrent.locks.ReentrantLock;%0A%0Aimport com.github.mottox.taomp.common.ThreadID;%0A%0A/**%0A * %E7%AE%80%E5%8D%95%E7%9A%84%E5%8F%AF%E9%87%8D%E5%85%A5%E9%94%81%E3%80%82%0A */%0Apublic class SimpleReentrantLock implements SimpleLock %7B%0A%0A    private Lock lock;%0A%0A    private Condition condition;%0A%0A    private volatile int owner;%0A%0A    private volatile int holdCount;%0A%0A    public SimpleReentrantLock() %7B%0A        // %E5%8F%AA%E6%98%AF%E5%80%9F%E7%94%A8java.util.concurrent.ReentrantLock%E6%9D%A5%E5%AE%9E%E7%8E%B0%E4%BA%92%E6%96%A5%E3%80%82%0A        this.lock = new ReentrantLock();%0A        this.condition = lock.newCondition();%0A        this.owner = -1;%0A        this.holdCount = 0;%0A    %7D%0A%0A    @Override%0A    public void lock() %7B%0A        int me = ThreadID.get();%0A        lock.lock();%0A        try %7B%0A            if (owner == me) %7B%0A                holdCount++;%0A                return;%0A            %7D%0A            while (holdCount != 0) %7B%0A                condition.await();%0A            %7D%0A            owner = me;%0A            holdCount = 1;%0A        %7D catch (InterruptedException e) %7B%0A            // empty%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void unlock() %7B%0A        lock.lock();%0A        try %7B%0A            if (holdCount == 0 %7C%7C owner != ThreadID.get()) %7B%0A                throw new IllegalMonitorStateException();%0A            %7D%0A            holdCount--;%0A            if (holdCount == 0) %7B%0A                condition.signal();%0A            %7D%0A        %7D finally %7B%0A            lock.unlock();%0A        %7D%0A    %7D%0A%0A%7D%0A

Implement SimpleReentrantLock.java