mirror of
https://github.com/ruby/ruby.git
synced 2025-09-18 10:03:59 +02:00
merge revision(s) b3c53a8a88
: [Backport #17672]
Make Ractor stdio belonging to the Ractor [Bug #17672] Defer making ractor stdio until ractor started. Before ractor started, created objects belong to the caller ractor instead of the created ractor. --- bootstraptest/test_ractor.rb | 12 ++++++++++++ ractor.c | 9 --------- thread.c | 9 +++++++++ 3 files changed, 21 insertions(+), 9 deletions(-)
This commit is contained in:
parent
6bf32cbed8
commit
6f9e007729
4 changed files with 22 additions and 10 deletions
9
thread.c
9
thread.c
|
@ -770,6 +770,11 @@ thread_do_start(rb_thread_t *th)
|
|||
|
||||
void rb_ec_clear_current_thread_trace_func(const rb_execution_context_t *ec);
|
||||
|
||||
// io.c
|
||||
VALUE rb_io_prep_stdin(void);
|
||||
VALUE rb_io_prep_stdout(void);
|
||||
VALUE rb_io_prep_stderr(void);
|
||||
|
||||
static int
|
||||
thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
|
||||
{
|
||||
|
@ -792,6 +797,10 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start)
|
|||
RB_VM_LOCK();
|
||||
{
|
||||
rb_vm_ractor_blocking_cnt_dec(th->vm, th->ractor, __FILE__, __LINE__);
|
||||
rb_ractor_t *r = th->ractor;
|
||||
r->r_stdin = rb_io_prep_stdin();
|
||||
r->r_stdout = rb_io_prep_stdout();
|
||||
r->r_stderr = rb_io_prep_stderr();
|
||||
}
|
||||
RB_VM_UNLOCK();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue