Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions internal/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ void rb_thread_io_close_wait(struct rb_io *);

void rb_ec_check_ints(struct rb_execution_context_struct *ec);

void rb_thread_free_native_thread(void *th_ptr);

RUBY_SYMBOL_EXPORT_BEGIN

void *rb_thread_prevent_fork(void *(*func)(void *), void *data); /* for ext/socket/raddrinfo.c */
Expand Down
9 changes: 9 additions & 0 deletions thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ thread_cleanup_func(void *th_ptr, int atfork)
rb_native_mutex_destroy(&th->interrupt_lock);
}

void
rb_thread_free_native_thread(void *th_ptr)
{
rb_thread_t *th = th_ptr;

native_thread_destroy_atfork(th->nt);
th->nt = NULL;
}

static VALUE rb_threadptr_raise(rb_thread_t *, int, VALUE *);
static VALUE rb_thread_to_s(VALUE thread);

Expand Down
3 changes: 1 addition & 2 deletions vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3306,8 +3306,7 @@ ruby_vm_destruct(rb_vm_t *vm)
rb_id_table_free(vm->constant_cache);
set_free_table(vm->unused_block_warning_table);

xfree(th->nt);
th->nt = NULL;
rb_thread_free_native_thread(th);

#ifndef HAVE_SETPROCTITLE
ruby_free_proctitle();
Expand Down