diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-03-03 08:40:00 +0100 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-03-23 09:08:19 +0000 |
commit | 3563e1383fe4ce13168cd3b9f4d5222d69d00061 (patch) | |
tree | 666b61248378187c92056113a6fcd725aa10223e /.dir-locals.el | |
parent | a9146bd81e8a9085cfa920ee485deb43b3a2a776 (diff) | |
download | ruby-3563e1383fe4ce13168cd3b9f4d5222d69d00061.tar.gz |
thread_pthread.c: Use a `fork_gen` to protect against fork instead of getpid()
[Feature #19443]
Until recently most libc would cache `getpid()` so this was a cheap check to make.
However as of glibc version 2.25 the PID cache is removed and calls to getpid() always
invoke the actual system call which significantly degrades the performance of existing applications.
The reason glibc removed the cache is that some libraries were bypassing fork(2)
by issuing system calls themselves, causing stale cache issues.
That isn't a concern for Ruby as bypassing MRI's primitive for forking would
render the VM unusable, so we can safely cache the PID.
Diffstat (limited to '.dir-locals.el')
0 files changed, 0 insertions, 0 deletions