You can't create a background thread for a task, but you can schedule it via a static RunAsync method on the Windows.System.Threading.ThreadPool class.

Create a high priority thread that runs forever


using System.Diagnostics;

	Stopwatch Stopwatch1;

	//----- START OUR HIGH PRIORITY BACKGROUND THREAD -----
	//We don't await it as its goign to run for the lifetime of the application in the background
	Windows.System.Threading.ThreadPool.RunAsync(this.MyHighPriorityBackgroundThread, Windows.System.Threading.WorkItemPriority.High);


		//******************************************************
		//******************************************************
		//********** HIGH PRIORITY BACKGROUND THREAD ***********
		//******************************************************
		//******************************************************
		private void MyHighPriorityBackgroundThread(Windows.Foundation.IAsyncAction action)
		{
			//This thread runs on a high priority task and loops forever
			while (true)
			{
				//DO SOMETHING...


				
			}
		}

 

 

UK Electronic Designer
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.