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

25 lines
604 B
C#
Raw Permalink Normal View History

2023-08-30 05:50:21 +00:00
using System;
using DotNetty.Transport.Channels;
namespace dotNetty_kcp.thread
{
public class EventLoopScheduleThread : IScheduleThread
{
private readonly IEventLoop _eventLoop = new SingleThreadEventLoop();
public void schedule(IScheduleTask scheduleTask, TimeSpan timeSpan)
{
_eventLoop.Schedule(scheduleTask, timeSpan);
}
public void stop()
{
if (_eventLoop.IsShuttingDown)
{
return;
}
_eventLoop.ShutdownGracefullyAsync();
}
}
}