public ScheduledFutureAwaiter(Future future, FutureScheduler scheduler) { ThrowHelper.NotNull(scheduler, nameof(scheduler)); _future = future; _scheduler = scheduler; }
private void Run() { FutureScheduler.SetContextualScheduler(this); foreach (var c in _workQueue.GetConsumingEnumerable()) { c.Callback(c.State); } }
public async Task ContextualAsyncTest() { var syncContext = new TestSynchronizationContext(); var scheduler = FutureScheduler.FromSynchronizationContext(syncContext); async ContextualFuture LocalTest() { syncContext.AssertCurrentContext(); await LocalTest2(); } async Future LocalTest2() { await FutureScheduler.ThreadPool; Assert.Null(SynchronizationContext.Current); } await scheduler.Run(() => LocalTest()); }
public ScheduledFutureAwaitable(Future future, FutureScheduler scheduler) { _future = future; _scheduler = scheduler; }
internal Future(FutureScheduler scheduler = null) { Scheduler = scheduler; }