首页 > 代码库 > Ruby:线程实现经典的生产者消费者问题

Ruby:线程实现经典的生产者消费者问题

运行结果:

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