Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HashedWheelTimer

Nuget

High performance and light weight HashedWheelTimer implement by c#

fork from DotNetty

Install nuget package

dotnet add package WheelTimer

Usages

// 1. Inheritance interface: `ITimerTask`
// such as:
public class ActionTimerTask : ITimerTask
{
    readonly Action<ITimeout> action;

    public ActionTimerTask(Action<ITimeout> action) => this.action = action;

    public void Run(ITimeout timeout) => this.action(timeout);
}

// 2. add ITimerTask by `NewTimeout` method
ITimer timer = new HashedWheelTimer(TimeSpan.FromMilliseconds(100), 512, -1);
ITimeout timeout = timer.NewTimeout(
    new ActionTimerTask(
        t =>
        {
           // do what you want here
        }),
    TimeSpan.FromSeconds(10));

timer.StopAsync().Wait();
``

About

High performance and light weight HashedWheelTimer implement by c#

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages