//一个信号量,只有在池中还拥有许可时才允许线程继续执行。//先看构造函数//默认是非公平模式publicSemaphore(intpermits){sync=newNonfairSync(permits);}NonfairSync(intpermits){super(permits);}//设置状态Sync(intpermits){setState(permits);}publicSemaphore(intpermits,booleanfair){sync=fair?newFairSync...
查看全文