High performance and light weight HashedWheelTimer implement by c#
fork from DotNetty
dotnet add package WheelTimer
// 1. Inheritance interface: `ITimerTask`// such as:publicclassActionTimerTask:ITimerTask{readonlyAction<ITimeout>action;publicActionTimerTask(Action<ITimeout>action)=>this.action=action;publicvoidRun(ITimeouttimeout)=>this.action(timeout);}// 2. add ITimerTask by `NewTimeout` methodITimertimer=newHashedWheelTimer(TimeSpan.FromMilliseconds(100),512,-1);ITimeouttimeout=timer.NewTimeout(newActionTimerTask(
t =>{// do what you want here}),TimeSpan.FromSeconds(10));timer.StopAsync().Wait();
``