Skip to content

Commit

Permalink
CatchScheduler.CatchSchedulerLongRunning: Avoid closure allocation an…
Browse files Browse the repository at this point in the history
…d allow delegate caching.
  • Loading branch information
danielcweber committed May 28, 2018
1 parent 0c8e295 commit 47ef6fc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions Rx.NET/Source/src/System.Reactive/Concurrency/CatchScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,18 @@ public CatchSchedulerLongRunning(ISchedulerLongRunning scheduler, Func<TExceptio

public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
{
return _scheduler.ScheduleLongRunning(state, (state_, cancel) =>
{
try
{
action(state_, cancel);
}
catch (TException exception) when (_handler(exception))
return _scheduler.ScheduleLongRunning(
(scheduler: this, action, state),
(tuple, cancel) =>
{
}
});
try
{
tuple.action(tuple.state, cancel);
}
catch (TException exception) when (tuple.scheduler._handler(exception))
{
}
});
}
}

Expand Down

0 comments on commit 47ef6fc

Please sign in to comment.