Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save some allocations and allow delegate caching in ScheduleAsync. #722

Merged
merged 1 commit into from
Jul 2, 2018
Merged

Save some allocations and allow delegate caching in ScheduleAsync. #722

merged 1 commit into from
Jul 2, 2018

Conversation

danielcweber
Copy link
Collaborator

No description provided.


public AsyncInvocation(IScheduler self, TState s, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
{
action(new CancelableScheduler(self, _cts.Token), s, _cts.Token).ContinueWith(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't execute this in the constructor in case the class initialization hasn't become properly visible at this point. This could be a plain method returning this and simply use return new AsyncInvocation().Run(self, s, action);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Fixed in a minute.

@danielcweber danielcweber merged commit 11c9f7d into dotnet:master Jul 2, 2018
@danielcweber danielcweber deleted the OptimizeScheduleAsync branch July 2, 2018 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants