Skip to content

sunaku/ruby-coroutine-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This example shows how to embed Ruby using different C coroutine libraries: * libpcl http://www.xmailserver.org/libpcl.html * pthread https://computing.llnl.gov/tutorials/pthreads/ * ucontext http://www.gnu.org/s/libc/manual/html_node/System-V-contexts.html That are initialized using two distinct stack allocation methods: * static The coroutine stack is baked into the shared object file. * dynamic The coroutine stack is allocated dynamically, at runtime. And optionally using my ruby_bind_stack() patch for Ruby 1.9.x, if present: * https://github.com/sunaku/ruby/compare/trunk...2294_bind_stack.patch * http://bugs.ruby-lang.org/issues/show/2294 ****************************************************************************** * NOTE: Without the above patch, this example WILL FAIL for Ruby 1.9.x! * ****************************************************************************** To run this example, use the provided `run.sh` script: sh run.sh # displays usage info sh run.sh pcl static ~/.rvm/rubies/* sh run.sh pcl dynamic ~/.rvm/rubies/* sh run.sh pthread static ~/.rvm/rubies/* sh run.sh pthread dynamic ~/.rvm/rubies/* sh run.sh ucontext static ~/.rvm/rubies/* sh run.sh ucontext dynamic ~/.rvm/rubies/* I hope this helps you learn how to embed Ruby inside C coroutines. Enjoy! 

About

How to embed Ruby inside C coroutines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published