functionconsumer()for i =1,10dolocal i =receive()print(i)endendfunctionreceive()local status,value = coroutine.resume(newProductor)return value
endfunctionproductor()local x =0for i =1,3do
x = x +1send(x)--内部实现协程挂起endendfunctionsend(x)print("!!!!!!@@")
coroutine.yield(x)--返还x给主程,并挂起协程end
newProductor = coroutine.create(productor)--创建协程consumer()