protected internal override void QueueTask(Task task)
{
if ((task.CreationOptions & TaskCreationOptions.LongRunning) != 0) {
var thread = new Thread (l => ((Task)l).Execute ()) {
IsBackground = true
};
thread.Start (task);
return;
}
// Spicy Pixel: This seems to be working on AOT again. If not, use below.
// The main difference is that the callstack is not propagated with the
// unsafe method which allows for elevated security in the queued task
// (which is desirable here).
//
// Switching back to QueueUserWorkItem as it works with 2.0 subset.
// ThreadPool.UnsafeQueueUserWorkItem (callback, task);
ThreadPool.QueueUserWorkItem (callback, task);
}