维护了一个volatile int state共享资源和一个FIFO线程等待队列,state访问的三种方式: protected final void setState(int newState){state = newState;} protected final int getState(){return state;} protected final boolean compareAndSetState(int expect,int update){ return unsafe.compareAndSwapInt(this,stateOffset,expect,update); ...