In UWP, how can I access the thread object? I want to change the name of the main thread and additional thread that I will manage.
I also want to check if the current thread is the main thread afterwards.
I'm targeting to windows 10 mobile. The following code example works for desktop, but not for phone (getting 'System.DllNotFoundException'):
[DllImport("kernel32.dll")]
static extern IntPtr GetCurrentThread();
Thanks.
You should use Tasks instead of threads. https://msdn.microsoft.com/en-us/library/system.threading.tasks.task%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
As about renaming of threads, can you tell me why do you need to rename main thread and other threads!?
You should try System.Environment.CurrentManagedThreadId (yes, you can get only current thread id) https://msdn.microsoft.com/en-us/library/system.environment.currentmanagedthreadid(v=vs.110).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With