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 2024-09-19 17:23:19 +09:00
parent d9f6e326ad
commit dc8c382266
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465
Notes: git 2024-09-19 09:13:39 +00:00

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();
}