Commit Graph

10 Commits

Author SHA1 Message Date
ko1 cf16f0de0f * test/ruby/test_fiber.rb: fix to require 'continuation'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 20:54:50 +00:00
ko1 977d66ec99 * cont.c: separate Continuation and Fiber from core.
* ext/continuation/*, ext/fiber/*: ditto.
* include/ruby/ruby.h: remove rb_cFiber.
* include/ruby/intern.h: add the rb_fiber_new() declaration.
* enumerator.c (next_init): fix to use rb_fiber_new().
* test/ruby/test_enumerator.rb: remove next? tests.
* test/ruby/test_continuation.rb: add a require 'continuation'.
* test/ruby/test_fiber.rb: add a require 'fiber'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 02:03:44 +00:00
ko1 c5e4cd0638 * cont.c: add Fiber#resume and Fiber.yield.
and Fiber::Core class to realize Coroutine.
* include/ruby/intern.h: declare rb_fiber_yield(), rb_fiber_resume(),
* enumerator.c: use above api.
* test/ruby/test_fiber.rb: fix and add tests for above changes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13130 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-21 18:51:39 +00:00
ko1 31ac946975 * cont.c (rb_cont_call): forbid cross fiber continuation call.
* test/ruby/test_fiber.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-15 03:20:13 +00:00
ko1 8620de6b04 * cont.c (cont_restore_1): fix to check root fiber [ruby-dev:30911].
* test/ruby/test_fiber.rb: add a test.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-07 03:48:13 +00:00
ko1 6d2dee14f3 * test_fiber.rb: add a test (Continuation and Fiber).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-06 18:30:14 +00:00
ko1 d80e7373cf * cont.c (cont_new): add debug message.
* cont.c (cont_restore_1): copy stack information from fiber.
* cont.c (rb_fiber_s_new): fix to mark created fiber.
* test/ruby/test_fiber.rb: add some tests around Thread and Fiber.
* yarvcore.c (thread_free): fix to skip freeing stack if root fiber
  is available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12454 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-06 18:19:42 +00:00
ko1 64ffdb4440 * cont.c (rb_fiber_start): clear th->tag and check error to fix
[ruby-dev:30888] and [ruby-dev:30889].
* eval_intern.h: fix rb_fiber_start() prototype.
* test/ruby/test_fiber.rb: add tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-05 17:55:07 +00:00
ko1 6b3ef2249c * cont.c (Fiber#pass): rename to Fiber#yield. Block parameter
of fiber body receive first yield values.
  e.g.: Fiber.new{|x| p x}.yield(:ok) #=> :ok
* cont.c: rename rb_context_t#retval to rb_context_t#value.
* test/ruby/test_fiber.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-02 07:48:29 +00:00
ko1 57062d91b9 * cont.c: support Fiber. Check test/ruby/test_fiber.rb for detail.
Fiber is known as "Micro Thread", "Coroutine", and other terms.
  At this time, only Fiber#pass is supported to change context.
  I want to know more suitable method name/API for Fiber (... do you
  know more suitable class name instead of Fiber?) as "suspend/resume",
  "call", "yield", "start/kick/stop/restart", ....
* eval.c, eval_intern.h, thread.c, yarvcore.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-27 19:12:43 +00:00