From e5f3b1a5cc39db25503f1d175fbd0f93c04a85c6 Mon Sep 17 00:00:00 2001 From: ko1 Date: Sun, 27 May 2007 19:12:43 +0000 Subject: * 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: http://svn.ruby-lang.org/repos/ruby/trunk@12395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval_intern.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'eval_intern.h') diff --git a/eval_intern.h b/eval_intern.h index 2bc529db9..157e7a58b 100644 --- a/eval_intern.h +++ b/eval_intern.h @@ -117,6 +117,14 @@ char *strrchr _((const char *, const char)); #include +#define SAVE_ROOT_JMPBUF(th, stmt) do \ + if (ruby_setjmp((th)->root_jmpbuf) == 0) { \ + stmt; \ + } \ + else { \ + rb_fiber_start(th); \ + } while (0) + #define TH_PUSH_TAG(th) do { \ rb_thread_t * const _th = th; \ struct rb_vm_tag _tag; \ -- cgit