Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.Threading.Thread is not supported in Windows 8 Store app

Windows 8 Store app does not support Thread anymore:

I create a thread in class library:

protected static Thread m_thread = null;

Then in one of the functions:

m_thread = new Thread(new ParameterizedThreadStart(RunDetection));
m_thread.Start(Something);

I also need to abort the function:

m_thread.Abort();

How can I do this in a WIN8 store app?

like image 721
Alvin Avatar asked Dec 26 '22 10:12

Alvin


1 Answers

You can run your thread procedure on the threadpool.

  • Using the thread pool in Windows Store apps
  • ThreadPool class

Aborting a thread has never been a viable option, as it could hang your entire process (abandoned lock, inconsistent global state).

like image 84
Ben Voigt Avatar answered Jan 04 '23 22:01

Ben Voigt