摘要:
coroutine我自己的理解是伪中断。在调用coroutine.yeild时就会自动调用正在wait中的coroutine.resume。并且会把yeild里面的参数按顺序作为resume的第二、三等返回值返回。resume第一返回值是coroutine的状态。function receive(prod) local status, value = coroutine.resume(prod) return valueendfunction send(x) coroutine.yield(x)endfunction producer() local i = 0 ... 阅读全文
posted @ 2013-07-02 22:28
陈易水
阅读(2084)
评论(0)
推荐(0)
浙公网安备 33010602011771号