-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Name native threads before start (macOS/Native AOT) #114249
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs:140
- The assignment to _startHelper._thread = this is repeated in several constructors wrapped in #if TARGET_OSX. Consider refactoring this repeated pattern into a helper method to reduce duplication and simplify maintenance.
_startHelper = new StartHelper(start);
Tagging subscribers to this area: @mangod9 |
1d2f58a
to
3f46bf2
Compare
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
Outdated
Show resolved
Hide resolved
if (!string.IsNullOrEmpty(_thread.Name)) | ||
{ | ||
// Name the underlying native thread to match the managed thread name. | ||
_thread.ThreadNameChanged(_thread.Name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ThreadNameChanged
sets the OS thread name, and also notifies profiler and debugger on CoreCLR about the thread name change. These notifications are superfluous here. I am not sure whether it matters.
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
Outdated
Show resolved
Hide resolved
b8ede59
to
212f47a
Compare
f069af0
to
bb816b8
Compare
38f7487
to
9efae7c
Compare
9efae7c
to
18c9010
Compare
Since checking the native thread name is platform specific rather than cross-platform and also there were errors in some Windows legs about not finding the native methods in |
src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Fixes #106464.