diff options
author | Koichi Sasada <[email protected]> | 2020-11-30 16:18:43 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-12-01 15:44:18 +0900 |
commit | 182fb73c40351f917bf44626c44c1adb6cb1aa5a (patch) | |
tree | fe9dd0b8c312dc491b1576004ce80122b77fbfe4 /vm_core.h | |
parent | 8247b8eddeb2a504a5c9776d1f77d413c8146897 (diff) |
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]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3824
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -912,6 +912,10 @@ void rb_ec_initialize_vm_stack(rb_execution_context_t *ec, VALUE *stack, size_t // @param ec the execution context to update. void rb_ec_clear_vm_stack(rb_execution_context_t *ec); +struct rb_ext_config { + bool ractor_safe; +}; + typedef struct rb_ractor_struct rb_ractor_t; typedef struct rb_thread_struct { @@ -1000,6 +1004,8 @@ typedef struct rb_thread_struct { /* misc */ VALUE name; + struct rb_ext_config ext_config; + #ifdef USE_SIGALTSTACK void *altstack; #endif @@ -1994,6 +2000,8 @@ extern void rb_reset_coverages(void); void rb_postponed_job_flush(rb_vm_t *vm); +extern VALUE rb_eRactorUnsafeError; // ractor.c + RUBY_SYMBOL_EXPORT_END #endif /* RUBY_VM_CORE_H */ |