Skip to content

Commit 8d27a7f

Browse files
authored
Declare TypedData with RUBY_TYPED_THREAD_SAFE_FREE (#222)
Available on Ruby 4.1: [Feature #22067] Ref: https://bugs.ruby-lang.org/issues/22067 When available this flag superseed RUBY_TYPED_FREE_IMMEDIATELY and allow parallel sweeping of the type.
1 parent cff28a1 commit 8d27a7f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ext/stringio/stringio.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,18 @@ strio_memsize(const void *p)
116116
return sizeof(struct StringIO);
117117
}
118118

119+
#ifndef RUBY_TYPED_THREAD_SAFE_FREE
120+
#define RUBY_TYPED_THREAD_SAFE_FREE RUBY_TYPED_FREE_IMMEDIATELY
121+
#endif
122+
119123
static const rb_data_type_t strio_data_type = {
120124
"strio",
121125
{
122126
strio_mark,
123127
strio_free,
124128
strio_memsize,
125129
},
126-
0, 0, RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
130+
0, 0, RUBY_TYPED_THREAD_SAFE_FREE | RUBY_TYPED_WB_PROTECTED
127131
};
128132

129133
#define check_strio(self) ((struct StringIO*)rb_check_typeddata((self), &strio_data_type))

0 commit comments

Comments
 (0)