aboutsummaryrefslogtreecommitdiffstats
path: root/cont.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 02:47:58 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-16 02:47:58 +0000
commitb933a31076814f2ffca7d2dedb8b649916365949 (patch)
tree52e682beed9b5df4cd7c014c9f0fe63f267c2d30 /cont.c
parent7361cb893f8354eb89b16f587e29ab7a3fec0375 (diff)
downloadruby-b933a31076814f2ffca7d2dedb8b649916365949.tar.gz
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 cebb7a28de..d4d6f2e60d 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);