Hacker News new | past | comments | ask | show | jobs | submit login

In lthread-cpp (wrapper around lthread) it's even easier because of RAII. Example:

http://lthread-cpp.readthedocs.org/en/latest/listener.html#e...

TCPListener closes the socket once its done and cleans up. And it also allows you to pass instance methods as the coroutine which has the advantage of accessing the instance context.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: