/// <summary> /// Dispatches an asynchronous message to the async context. If all tasks have been completed and the outstanding asynchronous operation count is zero, then this method has undefined behavior. /// </summary> /// <param name="d">The <see cref="T:System.Threading.SendOrPostCallback"/> delegate to call. May not be <c>null</c>.</param> /// <param name="state">The object passed to the delegate.</param> public override void Post(SendOrPostCallback d, object state) { _context.Enqueue(_context._taskFactory.Run(() => d(state)), true); }
/// <summary> /// Queues a <see cref="T:System.Threading.Tasks.Task"/> to the scheduler. If all tasks have been completed and the outstanding asynchronous operation count is zero, then this method has undefined behavior. /// </summary> /// <param name="task">The <see cref="T:System.Threading.Tasks.Task"/> to be queued.</param> protected override void QueueTask(Task task) { _context.Enqueue(task, false); }