Skip to content
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

Performance: Using newer Environment.CurrentManagedThreadId for UI/Main thread check #8240

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

MegaChuck64
Copy link

https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1840

According to Microsoft, System.Environment.CurrentManagedThreadId is a 'compact and efficient replacement' to Thread.CurrentThread.ManagedThreadId.

I've made this change in Platform/Threading.cs where the UI thread is checked.

@MegaChuck64 MegaChuck64 changed the title Using newer Environment.CurrentManagedThreadId for UI/Main thread check Performance Improvement: Using newer Environment.CurrentManagedThreadId for UI/Main thread check. Mar 14, 2024
@MegaChuck64 MegaChuck64 changed the title Performance Improvement: Using newer Environment.CurrentManagedThreadId for UI/Main thread check. Performance: Using newer Environment.CurrentManagedThreadId for UI/Main thread check Mar 14, 2024
@Mindfulplays
Copy link
Contributor

Neat! Also, MonoGameAndroidGameView has a couple of references...

@MegaChuck64
Copy link
Author

Neat! Also, MonoGameAndroidGameView has a couple of references...

thanks, updated those!

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.

None yet

2 participants