Fix bug at fork on FreeBSD

The main thread in a forked process appears not to own the read-write
lock.
This commit is contained in:
Nobuyoshi Nakada committed 2024-09-19 18:08:12 +09:00
1 parent d9f6e326ad
commit dc8c382266
1 file changed
+7 -1
Notes: git 2024-09-19 09:13:39 +00:00
+7 -1
View File
@@ -4234,7 +4234,13 @@ rb_fork_ruby(int *status)
child.error = err = errno;
disable_child_handler_fork_parent(&old); /* yes, bad name */
rb_thread_release_fork_lock();
if (
#if defined(__FreeBSD__)
pid != 0 &&
#endif
true) {
rb_thread_release_fork_lock();
}
if (pid == 0) {
rb_thread_reset_fork_lock();
}