Jhayes2118
Jhayes2118

Reputation: 842

ThreadPool.QueueUserWorkItem() not available on PCL for MVVMCross 3.2.1

I am creating an MVVMcross Xamarin application and I am trying to spin a thread to get results from a dabate and update the list when it calls back. I have done this sort of thing before using Win 8 and iOS, but it seems that System.Threading.ThreadPool is not available the profile I am using. (Profile 259 or 79 can't remember which one I am using but it is for MVVMCross 3.2.1)

ThreadPool.QueueUserWorkItem(CallBack, DoStuff);

Am I forgetting something here or is this just not how it's done anymore.

Upvotes: 1

Views: 1187

Answers (1)

Immo Landwerth
Immo Landwerth

Reputation: 3249

The replacement for ThreadPool.QueueUserWorkItem is Task.Run:

Task result = Task.Run(() => DoStuff());

Update

Please note that Task.Run and Task.Factory.StartNew are not behaving the same. See Stephen Toub's awesome blog post on this topic.

Upvotes: 4

Related Questions