-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add IsOnMainThread to IMvxMainThreadDispatcher #2791
Comments
Sounds like a good addition! Can you make a PR for this? |
I will take a look at this issue. |
So, I have been thinking a bit, and considered to expose a property called
I have although read that the main thread may not always be So, I considered persisting the Any ideas? |
That class doesn't need to be abstract i think. You could just remove that and add the code. |
I am nearly done with my effort, @Cheesebaron and @martijn00, but wanted to know if you guys think it is the right direction to go: As a note, it does build ;) |
@david-laundav I don't think that we should be looking at the threadid. Currently each platform has their own implementation of checking to see if the current execution context is on the UI thread. Can you make the base property abstract and get each platform to implement it so that it's consistent? |
What is your proposal, @nickrandolph? I have spoken to @Cheesebaron about the approach, and both of us concurred that using the ThreadId would be the most efficient approach. Please refer to the following: |
Resolved by #2921 |
The
IMvxMainThreadDispatcher
now only allows you to run an action on the UI thread, regardless of the current thread.However, sometimes you'd want to run different code depending on the thread you're on (e.g. when you're working with a synchronized, thread-safe observable collection).
So a property on the
IMvxMainThreadDispatcher
indicating if the current thread is the main thread would be very helpful.The text was updated successfully, but these errors were encountered: