1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

rb_ext_ractor_safe() to declare ractor-safe ext

C extensions can violate the ractor-safety, so only ractor-safe
C extensions (C methods) can run on non-main ractors.
rb_ext_ractor_safe(true) declares that the successive
defined methods are ractor-safe. Otherwiwze, defined methods
checked they are invoked in main ractor and raise an error
if invoked at non-main ractors.

[Feature #17307]
This commit is contained in:
Koichi Sasada 2020-11-30 16:18:43 +09:00
parent 8247b8edde
commit 182fb73c40
Notes: git 2020-12-01 15:44:43 +09:00
7 changed files with 267 additions and 35 deletions

View file

@ -34,6 +34,10 @@ void rb_provide(const char*);
VALUE rb_f_require(VALUE, VALUE);
VALUE rb_require_string(VALUE);
// extension configuration
void rb_ext_ractor_safe(bool flag);
#define RB_EXT_RACTOR_SAFE(f) rb_ext_ractor_safe(f)
RBIMPL_SYMBOL_EXPORT_END()
#endif /* RBIMPL_INTERN_LOAD_H */