From e28760adfff7b516c7fd107feb4845e5cd6afece Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 10 Mar 2018 07:05:32 +0000 Subject: mjit.c: keep mutex unlocked on destroy `mjit_finish` may destroy mutex even while it's still locked by `worker` by race condition. That would result in the following error: [BUG] pthread_mutex_destroy: Device or resource busy (EBUSY) Actually I couldn't get a core dump for it and reproduce it multiple times. So I'm not sure this fixes the issue which I faced or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- mjit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'mjit.c') diff --git a/mjit.c b/mjit.c index 0cd2839d80..ecd3ee6c0a 100644 --- a/mjit.c +++ b/mjit.c @@ -926,9 +926,8 @@ worker(void) } } - CRITICAL_SECTION_START(3, "in the end of worker to update worker_finished"); + /* To keep mutex unlocked when it is destroyed by mjit_finish, don't wrap CRITICAL_SECTION here. */ worker_finished = TRUE; - CRITICAL_SECTION_FINISH(3, "in the end of worker to update worker_finished"); } /* MJIT info related to an existing continutaion. */ -- cgit v1.2.3