Skip to content

Commit

Permalink
Merge pull request #1116 from jkotas/generic-recursion
Browse files Browse the repository at this point in the history
Avoid infinite generics recursion in SynchronizationContextScheduler
  • Loading branch information
Oren Novotny committed Dec 24, 2019
2 parents c7c3b59 + 3cebafa commit 03aa3ed
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -93,7 +93,8 @@ public override IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Fun
return Schedule(state, action);
}

return DefaultScheduler.Instance.Schedule((scheduler: this, action, state), dt, (_, tuple) => tuple.scheduler.Schedule(tuple.state, tuple.action));
// Note that avoiding closure allocation here would introduce infinite generic recursion over the TState argument
return DefaultScheduler.Instance.Schedule(state, dt, (_, state1) => Schedule(state1, action));
}
}
}

0 comments on commit 03aa3ed

Please sign in to comment.