TimerSink.NET
4.3.1
dotnet add package TimerSink.NET --version 4.3.1
NuGet\Install-Package TimerSink.NET -Version 4.3.1
<PackageReference Include="TimerSink.NET" Version="4.3.1" />
<PackageVersion Include="TimerSink.NET" Version="4.3.1" />
<PackageReference Include="TimerSink.NET" />
paket add TimerSink.NET --version 4.3.1
#r "nuget: TimerSink.NET, 4.3.1"
#:package TimerSink.NET@4.3.1
#addin nuget:?package=TimerSink.NET&version=4.3.1
#tool nuget:?package=TimerSink.NET&version=4.3.1
TimerSink.NET
Uses a Stopwatch and PrecisionTimer to track a pool of Tasks and complete them at regular Intervals
The Resolution for events is 1 Millisecond and the TimerSink is capable of honoring it.
TimingSinkItems can be set to wait for the Synchronization Context, The default is ConfigureAwait(false)
Usage
Create a TimingSink
TimingSink tSink = new TimingSink();
Create a TimingSinkItem with ConfigureAwait(false) that will run every 200ms
private void TaskMethod() { // Your Code Here }
TimingSinkItem TaskToTime = new TimingSinkItem(TaskMethod, 200);
Add the TimingSinkItem to the TimingSink
tSink.TimingSinkItems.Add(TaskToTime);
Start the Sink.
tSink.Start();
Examples
Create a TimingSinkItem with ConfigureAwait(false) that will run every 200ms
TimingSinkItem TaskToTime = new TimingSinkItem(TaskMethod, 200);
private void TaskMethod() { }
Create a TimingSinkItem with ConfigureAwait(true)
TimingSinkItem TaskToTimeAwaitUI = new TimingSinkItem(TaskMethodUI, 200, true);
private void TaskMethodUI() { }
Create a TimingSinkItem with ConfigureAwait(true) and throwOnError to catch exceptions
TimingSinkItem TaskToTimeThrowError = new TimingSinkItem(TaskMethodUI, 200, true, true);
Check the Health of the Sink
if(tSink.SinkFaulted){ }
You can view a Full Example on Github
Warning
Your Tasks will execute at the Interval and Execution time is Excluded.
If you place a long running activity into a TimerSinkItem and set the Interval to be shorter than the execution time you will end up with multiple running Tasks
You can use LockedTask.NET to ensure there is only ever one of your Task for long running methods
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- PrecisionTimer.NET (>= 2.2.4.7)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TimerSink.NET:
| Package | Downloads |
|---|---|
|
Jackal
Shared memory reader for Assetto Corsa Competizione |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|