1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
k0kubun 2018-03-10 07:05:32 +00:00
parent e144481ed5
commit e28760adff

3
mjit.c
View file

@ -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. */