Skip to content

Thread events hooks: Pass concerned Thread to callbacks #8605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

osyoyu
Copy link
Contributor

@osyoyu osyoyu commented Oct 8, 2023

Let Thread event callback functions receive VALUE thread in concern. This will be a more stable way than calling gettid(2) in callbacks.

Let Thread event callback functions receive VALUE thread in concern.
This will be a more stable way than calling gettid(2) in callbacks.
Comment on lines +2454 to +2455
rb_internal_thread_event_data_t *data = ALLOC_N(rb_internal_thread_event_data_t, 1);
data->thread = th->self;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why dynamically allocating?
This seems a memory leak.

Suggested change
rb_internal_thread_event_data_t *data = ALLOC_N(rb_internal_thread_event_data_t, 1);
data->thread = th->self;
rb_internal_thread_event_data_t data[1] = {{.thread = th->self}};

@jpcamara
Copy link
Contributor

This was added in a separate PR so this should no longer be necessary #8885

@osyoyu osyoyu closed this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants