Hi, all

During the first week I was going through some existing cocoutines
implementation written in C to get myself some inspiration. Which includes
but not limit to A asymmetric coroutine library for
C<https://github.com/cloudwu/coroutine>,
the lwan web server <https://github.com/lpereira/lwan> (a server that is
similar to Monkey and already comes with coroutine support) and the
coroutine lib of lua <http://www.lua.org/>.

Also, a 
blog<http://tia.mat.br/blog/html/2012/09/29/asynchronous_i_o_in_c_with_coroutines.html>written
by the author of lwan is very worth reading. It mainly discuss
about how coroutine is used within the source of lwan from the high level
view, the details are in the source code.

Some difficulties while writing a coroutine library in C may occurs:

   - appropriate use of user space stack manipulation routines
   - the difficulties of debugging

Meanwhile, I also drafted the APIs that a simple coroutine module shall
contains:

   - coroutine_create
   - coroutine_release
   - coroutine_yield
   - coroutine_resume
   - coroutine_status

For the next week I will be implementing a basic coroutine library by
making use of the APIs offered by ucontext.h, which includes makecontextand
swapcontext. And then try to use the basic coroutine library to write a
event-loop based server demo.

Blog Post:
http://ghost-swpd.rhcloud.com/gsoc-2014-update-duda-io-coroutines-week-1-2/

Github Repo: https://github.com/swpd/monkey

Best Regards,

swpd
_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to