Add a new_thread flag to rb_interrupt_exec

Previously rb_ractor_interrupt_exec would use an intermediate function
to create a new thread with the actual target function, replacing the
data being passed in with a piece of malloc memory holding the "next"
function and the original data.

Because of this, passing rb_interrupt_exec_flag_value_data to
rb_ractor_interrupt_exec didn't have the intended effect of allowing
data to be passed in and marked.

This commit adds a rb_interrupt_exec_flag_new_thread flag, which
both simplifies the implementation and allows the original data to be
marked.
This commit is contained in:
John Hawthorn 2025-06-05 13:48:34 -07:00
parent 97994c77fb
commit a34fcf401b
Notes: git 2025-06-12 20:14:09 +00:00
2 changed files with 7 additions and 30 deletions

View file

@ -90,6 +90,7 @@ typedef VALUE (rb_interrupt_exec_func_t)(void *data);
enum rb_interrupt_exec_flag {
rb_interrupt_exec_flag_none = 0x00,
rb_interrupt_exec_flag_value_data = 0x01,
rb_interrupt_exec_flag_new_thread = 0x02,
};
// interrupt the target_th and run func.