The canonical way to implement a coroutine is to inherit from COROUTINE and implement the `invoke' feature using the `yield' call to return values.
On the client side, the coroutine is used via an iterator (see the `item' feature), calling the coroutine and returning a new value each time `yield' is called.
Meanwhile, there is a simple test case in the Liberty source.
Maybe you should put an example on how to use those?
ReplyDeleteYes, I should.
ReplyDeleteThe canonical way to implement a coroutine is to inherit from COROUTINE and implement the `invoke' feature using the `yield' call to return values.
On the client side, the coroutine is used via an iterator (see the `item' feature), calling the coroutine and returning a new value each time `yield' is called.
Meanwhile, there is a simple test case in the Liberty source.
Happy new year :-)