本帖最后由 陈琦 于 2012-10-15 16:28 编辑
- //我想问一下condition是在什么时候注册线程的??代码只表达一下意思
- class Food
- {
- String name;
- int count;
- private Lock lock = new ReentrantLock();
- private Condition condition_pro = lock.newCondition();//condition肯定没有注册线程吧
- private Condition condition_con = lock.newCondition();
- {
- }
- public void get() {
- condition_pro.wait();//难道是在现在注册的??哪个线程调用注册哪个么??
- }
- }
复制代码 |
|