-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save allocations of closures and allow delegate caching in Windows co…
…de that schedules async work. (#664) * Save allocations of closures and allow delegate caching in Windows code that schedules async work. * Cleanup some unused references.
- Loading branch information
1 parent
80a85ef
commit d981f09
Showing
4 changed files
with
34 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Rx.NET/Source/src/System.Reactive/Platforms/Windows/ThreadPoolTimerExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the Apache 2.0 License. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
#if WINDOWS | ||
using System.Reactive.Disposables; | ||
using Windows.System.Threading; | ||
using Windows.Foundation; | ||
|
||
namespace System.Reactive.Concurrency | ||
{ | ||
internal static class ThreadPoolTimerExtensions | ||
{ | ||
public static IDisposable AsDisposable(this ThreadPoolTimer threadPoolTimer) | ||
{ | ||
return Disposable.Create(threadPoolTimer, _ => _.Cancel()); | ||
} | ||
|
||
public static IDisposable AsDisposable(this IAsyncInfo asyncInfo) | ||
{ | ||
return Disposable.Create(asyncInfo, _ => _.Cancel()); | ||
} | ||
} | ||
} | ||
#endif |