Skip to content

allow thread destruction to run in other thread #3177

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

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

jrvidal
Copy link
Contributor

@jrvidal jrvidal commented Dec 2, 2022

This is the bare minimum that it's needed to allow running thread destructors from another thread.

Fixes #3176

i32.atomic.rmw.cmpxchg
if ;; label = @2
(func $__wbindgen_thread_destroy (type 3) (param i32 i32)
(local i32 i32)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

⚠️ These are a bit annoying. I couldn't find a way in walrus to generate references to function parameters without creating spurious locals.

@alexcrichton
Copy link
Contributor

Sorry for the delay, but seems reasonable to me, thanks!

@alexcrichton alexcrichton merged commit 430c68c into rustwasm:main Dec 12, 2022
@jrvidal jrvidal deleted the delegate-thread-destroy branch December 12, 2022 21:59
@daxpedda
Copy link
Collaborator

@jrvidal I have questions about how this is supposed to be used.

  • How do you get the __stack_alloc and __tls_base value for a specific thread?
  • Can you call this function from inside Rust?

It should probably also be documented somewhere publicly like in #2769.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow tearing down thread-allocated space from another thread
3 participants