首页 > 编程语言 > 详细

java多线程常见类与方法之java.util.concurrent.locks

时间:2016-10-17 14:30:11      阅读:187      评论:0      收藏:0      [点我收藏+]

1.java.util.concurrent.locks包里面的主要接口Lock,Condition,ReadWriteLock,主要的类为ReentrantLock,ReentrantReadWriteLock,ReentrantReadWriteLock.ReadLock,ReentrantReadWriteLock.WriteLock,LockSupport

2.ReentrantLock里面的主要方法为:lock(),unlock(),tryLock(),lockInterruptibly(),newCondition(),isHeldByCurrentThread(),isLocked();

  isFair(),hasQueuedThread(),getOwner(),getQueuedThreads();

3.Condition里面的主要方法为await(),signal(),signalAll();

4.ReentrantReadWriteLock里面的主要方法为:readLock(),WriteLock();

5.LockSupport里面的主要方法为:park(),unpark();

LockSupport.park(Thread t) :Disables the current thread for thread scheduling purposes unless the permit is available.

LockSupprt.unpark(Thread t):Makes available the permit for the given thread, if it was not already available.

java多线程常见类与方法之java.util.concurrent.locks

原文:http://www.cnblogs.com/fengfengtk/p/5969311.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!