From 3af5298e8cc9d88fb0c763fb623b722a97912877 Mon Sep 17 00:00:00 2001 From: ko1 Date: Fri, 21 Aug 2015 09:51:01 +0000 Subject: * include/ruby/ruby.h, cont.c, vm_trace.c: add a new event fiber_switch. We need more discussion about this feature so that I don't write it on NEWS. [Feature #11348] * test/ruby/test_settracefunc.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- cont.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cont.c') diff --git a/cont.c b/cont.c index fc0cf53..774a026 100644 --- a/cont.c +++ b/cont.c @@ -1260,8 +1260,9 @@ rb_fiber_start(void) th->errinfo = Qnil; th->root_lep = rb_vm_ep_local_ep(proc->block.ep); th->root_svar = Qfalse; - fib->status = RUNNING; + + EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, Qnil); cont->value = rb_vm_invoke_proc(th, proc, argc, argv, 0); } TH_POP_TAG(); @@ -1451,6 +1452,8 @@ fiber_switch(rb_fiber_t *fib, int argc, const VALUE *argv, int is_resume) value = fiber_store(fib, th); RUBY_VM_CHECK_INTS(th); + EXEC_EVENT_HOOK(th, RUBY_EVENT_FIBER_SWITCH, th->self, 0, 0, Qnil); + return value; } -- cgit v1.1