ruby-changes:50570
From: k0kubun <ko1@a...>
Date: Sat, 10 Mar 2018 16:05:37 +0900 (JST)
Subject: [ruby-changes:50570] k0kubun:r62714 (trunk): mjit.c: keep mutex unlocked on destroy
k0kubun 2018-03-10 16:05:32 +0900 (Sat, 10 Mar 2018) New Revision: 62714 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62714 Log: 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. Modified files: trunk/mjit.c Index: mjit.c =================================================================== --- mjit.c (revision 62713) +++ mjit.c (revision 62714) @@ -926,9 +926,8 @@ worker(void) https://github.com/ruby/ruby/blob/trunk/mjit.c#L926 } } - 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. */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/