diff options
| author | Étienne Barrié <etienne.barrie@gmail.com> | 2025-11-18 11:44:06 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-11-21 16:12:35 +0000 |
| commit | bdca2a9975c7859f2e1702a517d59bb6cb254acb (patch) | |
| tree | 6a50cc22607db2255d04bb914cd4802604551f1a /ext/json/parser/parser.c | |
| parent | 7ae0809c7c03b9d31a57fb18e9b0d173eead6f74 (diff) | |
[ruby/json] Ractor-shareable JSON::Coder
https://github.com/ruby/json/commit/58d60d6b76
Diffstat (limited to 'ext/json/parser/parser.c')
| -rw-r--r-- | ext/json/parser/parser.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c index a1d0265a91..e23945d0e5 100644 --- a/ext/json/parser/parser.c +++ b/ext/json/parser/parser.c @@ -1466,6 +1466,7 @@ static void parser_config_init(JSON_ParserConfig *config, VALUE opts) */ static VALUE cParserConfig_initialize(VALUE self, VALUE opts) { + rb_check_frozen(self); GET_PARSER_CONFIG; parser_config_init(config, opts); @@ -1553,6 +1554,11 @@ static size_t JSON_ParserConfig_memsize(const void *ptr) return sizeof(JSON_ParserConfig); } +#ifndef HAVE_RB_EXT_RACTOR_SAFE +# undef RUBY_TYPED_FROZEN_SHAREABLE +# define RUBY_TYPED_FROZEN_SHAREABLE 0 +#endif + static const rb_data_type_t JSON_ParserConfig_type = { "JSON::Ext::Parser/ParserConfig", { @@ -1561,7 +1567,7 @@ static const rb_data_type_t JSON_ParserConfig_type = { JSON_ParserConfig_memsize, }, 0, 0, - RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED, + RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | RUBY_TYPED_FROZEN_SHAREABLE, }; static VALUE cJSON_parser_s_allocate(VALUE klass) |
