运行结果:
ProAndCon
0 produced
1 produced
consumed 0
2 produced
3 produced
consumed 1
consumed 2
consumed 3
4 produced
consumed 4
5 produced
consumed 5
转载自:http://www.oschina.net/code/snippet_1045481_33311
Ruby:线程实现经典的生产者消费者问题,布布扣,bubuko.com
时间: 2024-11-17 10:19:48