Dict.CN 在线词典, 英语学习, 在线翻译 ------------- MyGitee My腾云code

Happy_EveryDay

可以平凡 不可以平庸 无爱则无忧,无欲则无求,无怒而无敌,无怨才是佛。所有烦恼,都是放不下的执著 开源技群 328035181 MyGitee

2021年4月6日

多线程 input生产 res(username,sex) out消费 synchronized(res) wait-notify

摘要: 1、wait 使用说明 public class Thread001 { class Res{ public String userName; private char sex; private boolean flag; } class InputThread extends Thread{ Re 阅读全文

posted @ 2021-04-06 10:32 cn2025 阅读(87) 评论(0) 推荐(0)

多线程wait

摘要: 当前线程变为阻塞(释锁) 放弃CPU执行 在同步代码块中使用且必须要通过对象.wait(this.wait) 释锁目的: 生产者写数据,防死锁 public class Thread002 { public static void main(String[] args) { new Thread00 阅读全文

posted @ 2021-04-06 00:52 cn2025 阅读(69) 评论(0) 推荐(0)

导航