摘要: 读《Programming In Lua》协程那一章,比较困惑的还是procuer-consumer那个例子:function consumer(prod) while true do local x = receive(prod) print(x) endendfunction receive(prod) local status, value = coroutine.resume(prod) return valueendfunction send(x) coroutine.yield(x) -- go back to where ... 阅读全文
posted @ 2012-11-17 21:24 lzprgmr 阅读(4556) 评论(1) 推荐(0) 编辑

黄将军