Skip to content

Conversation

akarnokd
Copy link
Collaborator

This PR inlines the SingleAssignmentDisposable behavior into the AutoDetachObserver to save on an allocation and the indirection.

set { _disposable.Disposable = value; }
set
{
if (Interlocked.CompareExchange(ref disposable, value, null) != null)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder whether we can refactor that reoccuring logic into extensions that take refs, taking the idea from AssignmentDisposable a bit further.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The Setter-extensions could be called "SetSingle", "SetMultiple" etc....

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I do this in my repo but this is dotnet/reactive.

The problem with such PRs is that if you need an utility for multiple other PRs as well, either it has to be PRd separately and then merged before anything in new PRs can use it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I do this in my repo but this is dotnet/reactive.

Awesome!

...then merged before anything in new PRs can use it.

Let's hope any of our work will be merged eventually. Until then, we could agree on some basic improvements (like the import of ValueTuples, those extensions etc.) on a separate branch and rebase all our PRs on that branch.

@clairernovotny clairernovotny merged commit 906d760 into dotnet:master May 26, 2018
@akarnokd akarnokd deleted the AutoDetachObserverEnhancement branch May 26, 2018 14:55
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.

3 participants