合并主线最近几年来的主要更新,重点推进TinyHttpClient,替代HttpClient
大石头 authored at 2023-03-08 18:39:12
932.00 B
X_NET20
using System.Collections.Generic;
using System.Security;

namespace System.Threading.Tasks
{
	internal class TpScheduler : TaskScheduler
	{
		private static readonly WaitCallback callback = TaskExecuterCallback;

		public override int MaximumConcurrencyLevel => base.MaximumConcurrencyLevel;

		[SecurityCritical]
		protected internal override void QueueTask(Task task)
		{
			ThreadPool.UnsafeQueueUserWorkItem(callback, task);
		}

		private static void TaskExecuterCallback(object obj)
		{
			Task task = (Task)obj;
			task.Execute();
		}

		protected override IEnumerable<Task> GetScheduledTasks()
		{
			throw new NotImplementedException();
		}

		[SecurityCritical]
		protected internal override bool TryDequeue(Task task)
		{
			throw new NotImplementedException();
		}

		[SecurityCritical]
		protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
		{
			return TryExecuteTask(task);
		}
	}
}