diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2020-12-20 21:42:25 -0500 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-12-23 18:36:08 +0900 |
commit | d4861854ecde00540c527f36aaacd257e63ed5a4 (patch) | |
tree | e618e0a88000d4dac45983be2465e522d9e8d1c8 /ext | |
parent | 0eb2c0c9a2cb66da217b5157419af7b912acb947 (diff) | |
download | psych-d4861854ecde00540c527f36aaacd257e63ed5a4.zip |
[ruby/psych] Make Ractor-ready.
Config is Ractor-local.
Benchmarking reveals that using `Ractor.local_storage` for storing cache
is similar to accessing a constant (~15% slower).
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/psych.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/psych/psych.c b/ext/psych/psych.c index 0afd731..8af0bb6 100644 --- a/ext/psych/psych.c +++ b/ext/psych/psych.c @@ -22,6 +22,9 @@ VALUE mPsych; void Init_psych(void) { + #ifdef HAVE_RB_EXT_RACTOR_SAFE + RB_EXT_RACTOR_SAFE(true); + #endif mPsych = rb_define_module("Psych"); rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0); |