-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expose a non-allocating way to access the current task name. #19445
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
Comments
It needs more than that because changing the task name will invalidate it. |
Maybe this is an appropriate use-case for dynamic borrow checking. We could return a |
Actually that would require full shared ownership, with |
And even then, |
I think I have a non-allocating solution using |
Currently,
std::task::name
allocates a newString
for the current task name, but this is unnecessary and slow.Note: this probably requires a
'thread
lifetime or a reference type specific to thread-local values, perhapsstruct ThreadRef<T> { nosend: NoSend, ref: &'static T }
, but I haven't really thought through all the use cases.The text was updated successfully, but these errors were encountered: