合并 System.Threading.Tasks.NET35
智能大石头 authored at 2023-03-16 23:32:48
416.00 B
X
namespace System.Threading.Tasks;

internal class SynchronizationContextContinuation : IContinuation
{
	private readonly Action action;

	private readonly SynchronizationContext ctx;

	public SynchronizationContextContinuation(Action action, SynchronizationContext ctx)
	{
		this.action = action;
		this.ctx = ctx;
	}

	public void Execute()
	{
		ctx.Post(delegate(object l)
		{
			((Action)l)();
		}, action);
	}
}