Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

ARGH!!! InvokeOnMainThread / InvokeInBackground / ThreadPool.QueueUserWorkItem / TPL / async / await

$
0
0

All I want to do is spin up a thread separate from the main UI which will run continuously, regardless of whether the app is in the foreground or background, and which the user can start/stop/pause/resume at will. Additionally, since this background-task is Audio related, I do not want it to be affected by the 10 minute "Long Running" background-thread limit.

Looking at both MSDN and the Xamarin site, there are like 15 ways to do threading, and I am thoroughly confused on what is the right approach.

Can someone !!!PLEASE!!! write a tutorial or something that goes into detail of when/why to use each of these different approaches, and ultimately, what is the best pattern to achieve what I stated above?

Right now I'm trying to use a combination of TPL & async / await, but the whole thing is a bloody mess... I could REALLY use some help on this!

Here are all the different approaches I've come across so far...

InvokeInBackground ThreadPool.QueueUserWorkItem Task.Run / Task.Factory.StartNew / new Task() Threading.Thread / Threading.ThreadStart async delegate { await foo() } UIApplication.SharedApplication.BeginBackgroundTask

Background Processing for Registered Apps vs. Background Tasks?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>