summaryrefslogtreecommitdiff
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 02:47:58 (GMT)
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 02:47:58 (GMT)
commit23e452b17b604c35339265b480b900581abc2ce3 (patch)
tree52e682beed9b5df4cd7c014c9f0fe63f267c2d30 /cont.c
parent575993d74386157a9554e2b4f9f350d673be9613 (diff)
cleanup hook cleanup code.
* vm_trace.c: before this patch, deleted hooks are remvoed at *the beggining* of hooks (exec_hooks_precheck). This patch cleanup deleted hooks at (1) just after hook is deleted (TracePoint#disable and so on) (2) just after executing hooks (exec_hooks_postcheck) Most of time (1) is enough, but if some threads running hooks, we need to wait cleaning up deleted hooks until threads finish running the hooks. This is why (2) is introduced (and this is why current impl cleanup deleted hooks at the beggining of hooks). * test/lib/tracepointchecker.rb: check also the number of delete waiting hooks. * cont.c (cont_restore_thread): fix VM->trace_running count. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'cont.c')
-rw-r--r--cont.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cont.c b/cont.c
index cebb7a2..d4d6f2e 100644
--- a/cont.c
+++ b/cont.c
@@ -704,6 +704,14 @@ cont_restore_thread(rb_context_t *cont)
th->ec->root_svar = sec->root_svar;
th->ec->ensure_list = sec->ensure_list;
th->ec->errinfo = sec->errinfo;
+
+ /* trace on -> trace off */
+ if (sec->trace_arg == NULL && th->ec->trace_arg != NULL) {
+ GET_VM()->trace_running--;
+ }
+ else if (sec->trace_arg == NULL && th->ec->trace_arg != NULL) {
+ GET_VM()->trace_running++;
+ }
th->ec->trace_arg = sec->trace_arg;
VM_ASSERT(th->ec->vm_stack != NULL);