Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #296 from TORISOUP/fix_sample_with_observable
Browse files Browse the repository at this point in the history
Change "Sample" operator behavior.
  • Loading branch information
neuecc authored Jul 16, 2018
2 parents 4911076 + 1b3437e commit b04640a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Assets/Plugins/UniRx/Scripts/Operators/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ public SampleTick(Sample parent)

public void OnCompleted()
{
lock (parent.gate)
{
if (parent.isUpdated)
{
parent.isUpdated = false;
parent.observer.OnNext(parent.latestValue);
}
if (parent.isCompleted)
{
try { parent.observer.OnCompleted(); } finally { parent.Dispose(); }
}
}
}

public void OnError(Exception error)
Expand Down

0 comments on commit b04640a

Please sign in to comment.