summaryrefslogtreecommitdiff
path: root/ext/ffi_c/Type.c
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2023-04-16 20:40:17 +0200
committerLars Kanis <lars@greiz-reinsdorf.de>2023-04-18 11:27:14 +0200
commit5247d3e736f77ce19bbb3e69cf5186fa5a7084f4 (patch)
tree9675fed8212b9ca4ffbe0929112be10bdd1c5919 /ext/ffi_c/Type.c
parent250c31a25d81339cfe928a433ada3c0f17eae580 (diff)
downloadffi-5247d3e736f77ce19bbb3e69cf5186fa5a7084f4.tar.gz
Add support for using FFI in Ractor
All objects are shareable now when frozen. All objects can be created in a non-main Ractor. Typedefs are a global mutable state and are not accessable from Ractor other than the main Ractor. So all Function, Struct, etc. must be defined in the main Ractor and can then be used in other Ractors.
Diffstat (limited to 'ext/ffi_c/Type.c')
-rw-r--r--ext/ffi_c/Type.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/ffi_c/Type.c b/ext/ffi_c/Type.c
index 194c81e..3431681 100644
--- a/ext/ffi_c/Type.c
+++ b/ext/ffi_c/Type.c
@@ -64,7 +64,7 @@ const rb_data_type_t rbffi_type_data_type = { /* extern */
},
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
- .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
};
static const rb_data_type_t builtin_type_data_type = {
@@ -77,7 +77,7 @@ static const rb_data_type_t builtin_type_data_type = {
.parent = &rbffi_type_data_type,
// IMPORTANT: WB_PROTECTED objects must only use the RB_OBJ_WRITE()
// macro to update VALUE references, as to trigger write barriers.
- .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED | FFI_RUBY_TYPED_FROZEN_SHAREABLE
};
static size_t