于紫洋 发表于 2012-3-17 20:40 我第一反应是定义一个初值0的 int 变量然后再生产者里自增,那个值不就是生产的台数么 同为新手,想法而已 ...
黑马肖凯骏 发表于 2012-3-17 20:44 不行啊!我尝试了,在生产者中自增,线程执行的不确定性 代码块之类的我都想过了,还是不知道怎么解决 ...
王亚男 发表于 2012-3-17 21:22 count = 50; 话说本例中……你循环多少次不就生产了多少电脑么~
魏群 发表于 2012-3-17 22:32 在factory里创建个count 生产线程没生产一个 count就加1; main线程里调用子线程的join()方法 ...
未命名.JPG (67.07 KB, 下载次数: 62)
下载附件
2012-3-18 00:46 上传
彭盼 发表于 2012-3-18 00:40 可以试试把count定义到info类中: 我修改了下,你看看是不是你想要的结果: