• 2024-12-08用CAS思想实现一个自旋锁
    publicclassSpinLockDemo{//原子引用线程AtomicReference<Thread>atomicReference=newAtomicReference<>();publicvoidmyLock(){Threadthread=Thread.currentThread();System.out.println(thread.getName()+"\t