From 6f5aaff73b2b4e17666308dde93e1ac4edb3927d Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 12 Jun 2008 13:01:38 +0000 Subject: * thread.c, vm_core.h, vm.c, thread_pthread.c, thread_win32.c: add deadlock detection. [ruby-dev:35044] * bootstraptest/test_thread.rb: add tests for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vm.c') diff --git a/vm.c b/vm.c index 29804bc48c..5814deb20b 100644 --- a/vm.c +++ b/vm.c @@ -1470,6 +1470,13 @@ thread_free(void *ptr) RUBY_FREE_UNLESS_NULL(th->stack); } + if (th->locking_mutex != Qfalse) { + rb_bug("thread_free: locking_mutex must be NULL (%p:%ld)", th, th->locking_mutex); + } + if (th->keeping_mutexes != Qfalse) { + rb_bug("thread_free: keeping_mutexes must be NULL (%p:%ld)", th, th->locking_mutex); + } + if (th->local_storage) { st_free_table(th->local_storage); } @@ -1537,6 +1544,8 @@ rb_thread_mark(void *ptr) RUBY_MARK_UNLESS_NULL(th->root_fiber); RUBY_MARK_UNLESS_NULL(th->stat_insn_usage); + RUBY_MARK_UNLESS_NULL(th->locking_mutex); + rb_mark_tbl(th->local_storage); if (GET_THREAD() != th && th->machine_stack_start && th->machine_stack_end) { -- cgit v1.2.3