upm_guru_kcp/Runtime/csharp-kcp/dotNetty-kcp/thread/HashedWheelScheduleThread.cs

25 lines
685 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using DotNetty.Common.Utilities;
namespace dotNetty_kcp.thread
{
/**
* netty的实现轮实现在unity环境下测试会导致cpu跑到50%
* 服务器端使用不错
*/
public class HashedWheelScheduleThread:IScheduleThread
{
private readonly HashedWheelTimer _hashedWheelTimer = new HashedWheelTimer(TimeSpan.FromMilliseconds(1),512,-1 );
public void schedule(IScheduleTask scheduleTask,TimeSpan timeSpan)
{
_hashedWheelTimer.NewTimeout(scheduleTask,timeSpan);
}
public void stop()
{
_hashedWheelTimer.StopAsync();
}
}
}